Re: Accessing @private superclass ivars
Re: Accessing @private superclass ivars
- Subject: Re: Accessing @private superclass ivars
- From: Joar Wingfors <email@hidden>
- Date: Tue, 20 Feb 2007 00:22:12 +0100
On Feb 20, 2007, at 12:08 AM, stephen joseph butler wrote:
You could write a category method for the class that returns the ivar.
AFAICT, this should be legal.
If they made it @private and not @protected you would have to assume
that it's for a reason. That reason could of course simply be that
it's prudent to make everything @private until you know a good reason
not to...
That said, it could very definitively _not_ be OK to access it
directly, even if it's technically possible.
The array could for example be created / populated / updated lazily
when it's accessed from the methods that currently have access to it.
I'm not saying that this needs to be the case, but the point is that
you can't know - and even if you do know now, it's something that
could change in the future.
The safe thing to do is to re-do everything in your own class, while
petitioning the maintainer of the superclass to expose the
functionality you need in the public / protected interface.
j o a r
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden