inherited implicitly created member is no member?
inherited implicitly created member is no member?
- Subject: inherited implicitly created member is no member?
- From: Matt Neuburg <email@hidden>
- Date: Tue, 1 Feb 2011 19:14:40 -0800
I got a little surprise today:
@interface MySuperClass : NSObject {
}
@property (nonatomic, copy) NSString* text;
@end
@implementation MySuperClass
@synthesize text;
@end
@interface MySubClass : MySuperClass...
And now, in MySubClass, if I try to talk about self->text, I get:
'struct MySubClass' has no member named 'text' (or the GCC equivalent)
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.
--
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