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

@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


  • Follow-Ups:
    • Re: @protected variable access
      • From: email@hidden
    • Re: @protected variable access
      • From: Ondra Cada <email@hidden>
    • Re: @protected variable access
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Timed out fetching data...
  • Next by Date: Resize Dimple
  • Previous by thread: Re: Timed out fetching data...
  • Next by thread: Re: @protected variable access
  • Index(es):
    • Date
    • Thread