• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
properties and subclasses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: properties and subclasses
      • From: Graham Cox <email@hidden>
    • Re: properties and subclasses
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: NSInteger vs int vs int32_t
  • Next by Date: Re: NSInteger vs int vs int32_t
  • Previous by thread: Re: Crash when calling va_arg()
  • Next by thread: Re: properties and subclasses
  • Index(es):
    • Date
    • Thread