Re: inherited implicitly created member is no member?
Re: inherited implicitly created member is no member?
- Subject: Re: inherited implicitly created member is no member?
- From: Matt Neuburg <email@hidden>
- Date: Tue, 1 Feb 2011 19:31:06 -0800
On Feb 1, 2011, at 7:23 PM, Kyle Sluder wrote:
> On Tue, Feb 1, 2011 at 7:14 PM, Matt Neuburg <email@hidden> wrote:
>> Of course I can fix this in several ways, of which the most obvious is to declare the ivar "text" explicitly in the interface for MySuperClass. But I'm curious; why does it happen? I thought declaring the property without the ivar meant that I was implicitly creating the ivar. And as far as the superclass is concerned, it does mean that. Why doesn't the subclass know about this? Thx! m.
>
> Declaring the property makes no guarantee about its storage. It just
> says you have methods named -text and -setText.
>
> For all the subclass knows, the superclass's implementation says
> `@dynamic text`, and uses some crazy storage mechanism like
> objc_setAssociatedObject.
Wait, you're going too fast for me. You say this makes no guarantee about the storage, but in fact an ivar "text" does get generated, since I can say self->text in the superclass; that's the whole point of implicit ivar generation. So what does the superclass know that the subclass doesn't? Thx - m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
_______________________________________________
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