Re: @protected variable access
Re: @protected variable access
- Subject: Re: @protected variable access
- From: j o a r <email@hidden>
- Date: Sun, 12 Sep 2004 10:35:30 +0200
On 2004-09-11, at 22.30, Tim Hart wrote:
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?
I would have assumed that you could have done that, but apparently it's
not within the scope of what is assumed to be done with protected
instances. This works however:
@implementation Bar
- (void) someMethod
{
int j = self->i;
}
@end
If you don't get a good explanation on this list on the rationale of
@protected, you could consider re-posting the question on
"objc-language".
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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