• 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: James Bucanek <email@hidden>
  • Date: Mon, 19 Feb 2007 16:18:57 -0700

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
_______________________________________________

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: Keith Duncan <email@hidden>
References: 
 >Accessing @private superclass ivars (From: Keith Duncan <email@hidden>)

  • Prev by Date: Re: Binding NSTreeController to NSArray
  • Next by Date: Re: Preventing beach balls
  • Previous by thread: Re: Accessing @private superclass ivars
  • Next by thread: Re: Accessing @private superclass ivars
  • Index(es):
    • Date
    • Thread