• 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: 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


References: 
 >Accessing @private superclass ivars (From: Keith Duncan <email@hidden>)
 >Re: Accessing @private superclass ivars (From: "stephen joseph butler" <email@hidden>)

  • Prev by Date: Re: Custom Shadow on an NSWindow
  • Next by Date: Re: Accessing @private superclass ivars
  • Previous by thread: Re: Accessing @private superclass ivars
  • Next by thread: Re: Accessing @private superclass ivars
  • Index(es):
    • Date
    • Thread