• 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: is protected broken, or am I?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is protected broken, or am I?


  • Subject: Re: is protected broken, or am I?
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 10 Oct 2002 22:45:15 +0200

On Thursday, October 10, 2002, at 09:23 , Matt Neuburg wrote:

According to the docs, @protected means "The instance variable is
accessible within the class that declares it and within classes that
inherit it."

MyClass is a class with an ivar myIvar. MySubClass is a subclass of
MyClass. myClassInstance and mySubClassInstance are instances of these two
classes, respectively. mySubClassInstance has a reference to
myClassInstance. In MySubClass, I say this:

[myClassInstance->myIvar doStuff];

And the compiler slaps my hand, saying: "instance variable `myIvar' is
declared protected".

Quite right, since this is a @public-type usage. @protected-type usage is that you access *your* property (ie. "self->myIvar"), not other instance's -- regardless which class' instance it is.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >is protected broken, or am I? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: case-insensitive strings
  • Next by Date: Re: is protected broken, or am I?
  • Previous by thread: is protected broken, or am I?
  • Next by thread: Re: is protected broken, or am I?
  • Index(es):
    • Date
    • Thread