• 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: Accessing @private superclass ivars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Accessing @private superclass ivars
      • From: Ofri Wolfus <email@hidden>
References: 
 >Re: Accessing @private superclass ivars (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: Accessing @private superclass ivars
  • Next by Date: Re: Read Only Files
  • Previous by thread: Re: Accessing @private superclass ivars
  • Next by thread: Re: Accessing @private superclass ivars
  • Index(es):
    • Date
    • Thread