• 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
Re: @protected variable access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >@protected variable access (From: Tim Hart <email@hidden>)

  • Prev by Date: Re: Getting value from table view row
  • Next by Date: New ML List Software
  • Previous by thread: @protected variable access
  • Next by thread: Re: @protected variable access
  • Index(es):
    • Date
    • Thread