@protected variable access
@protected variable access
- Subject: @protected variable access
- From: Tim Hart <email@hidden>
- Date: Sat, 11 Sep 2004 15:30:26 -0500
Assume the following:
@interface Foo :NSObject
{
@protected
int i;
}
@end
@interface Bar : Foo
-(id) initWithFoo:(Foo*)foo;
@end
So we have Bar as a subclass of Foo, but also initializable with an
instance of Foo - a quasi-copy initializer.
I was under the impression that initWithFoo could legally do the
following:
@implementation Bar
-(id) initWithFo:(Foo*)foo
{
i = foo->i;//legal access to a protected member.
}
@end
I know such access is legal in Java. My C++ is a bit rusty, but I'm
nearly certain it's legal there as well. Do I misunderstand the ObjC
rules for @protected, or is this a gcc 3.3 bug?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden