Re: Accessing @private superclass ivars
Re: Accessing @private superclass ivars
- Subject: Re: Accessing @private superclass ivars
- From: Keith Duncan <email@hidden>
- Date: Mon, 19 Feb 2007 23:50:32 +0000
On 19 Feb 2007, at 23:18, James Bucanek wrote:
Keith Duncan wrote on Monday, February 19, 2007:
I'm subclassing a class which has a private NSArray ivar containing
some objects I need access to in my subclass.
Cheat!
Objective-C's @defs(class_name) directive will be replaced with the
structure of any ObjC class as a struct statement. Create a typedef
using the @defs() directive, then cast your object pointer to that
type. You now have direct access all ivars; scope restrictions are
thrown out the window.
For obvious reasons, this isn't something you want to do on a
regular basis.
--
James Bucanek
Thats a brilliant way of doing it actually.
And yes its not something I'll be doing regularly.
- Keith
_______________________________________________
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