Re: is protected broken, or am I?
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.