properties and subclasses
properties and subclasses
- Subject: properties and subclasses
- From: James Maxwell <email@hidden>
- Date: Thu, 05 Jul 2012 08:25:38 -0700
I have a situation where I've created a subclass that overrides a number of synthesized property accessors in its superclass. What I'm wondering is whether the overridden methods will get called when using dot syntax, or if this will just return the (inherited) synthesized properties?
So the "Thing" class has a property:
@property thingProp* aProp;
which is synthesized:
@synthesize aProp;
then the subclass "SubclassThing" has a hand-coded accessor to modify precisely what aProp returns:
- (thingProp*)aProp
{
thingProp* somethingDifferent = notTheSameAsSuper;
return somethingDifferent;
}
With this setup, when I call mySubclassThing.aProp, do I get the synthesized property (inherited) or the overridden method return? That is, do I have to deliberately call [mySubclassThing aProp] to get the method return (i.e., not using dot syntax)? Or, saying it another way, does a subclass' hand-coded accessor override the superclass' synthesized accessor?
Strange question, I suppose, but it isn't totally clear to me what actually happens.
J.
James B Maxwell
Composer/Doctoral Candidate
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden