• 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: subclass overwriting superclass ivar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: subclass overwriting superclass ivar


  • Subject: Re: subclass overwriting superclass ivar
  • From: Sherm Pendley <email@hidden>
  • Date: Wed, 26 May 2010 08:28:17 -0400

On Wed, May 26, 2010 at 8:13 AM, vincent habchi <email@hidden> wrote:
> Le 26 mai 2010 à 13:40, email@hidden a écrit :
>
>> A subclass ivar is apparently overwriting a super class ivar.
>> When an instance of MGS_B sets stderrData the super class ivar tempFilePath gets overwritten.
>
> If I am not mistaken, if your superclass ivar is private (!= protected), it cannot be accessed from its subclasses. Thus, the compiler can choose to reuse part of the heap dedicated to private variables to implement subclasses own private ivars.

No way the compiler could do that. @private makes the superclass'
ivars invisible to subclasses, but they're still there. They have to
be, since the superclass' methods (which *can* see them) can be called
on the subclass as well.

There's nothing wrong with the ivar declarations - something must be
going wrong at run time. Typically, when an object pointer seems to
point to the wrong object, the prime suspect is memory management. But
it's hard to say for sure, without seeing the relevant code.

sherm--

--
Cocoa programming in Perl:
http://www.camelbones.org
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: subclass overwriting superclass ivar
      • From: "Sean McBride" <email@hidden>
    • Re: subclass overwriting superclass ivar
      • From: "email@hidden" <email@hidden>
References: 
 >subclass overwriting superclass ivar (From: "email@hidden" <email@hidden>)
 >Re: subclass overwriting superclass ivar (From: vincent habchi <email@hidden>)

  • Prev by Date: Re: OutlineView Wierdness - 'item' not being stored.
  • Next by Date: Re: rendering PDF on iPad's
  • Previous by thread: Re: subclass overwriting superclass ivar
  • Next by thread: Re: subclass overwriting superclass ivar
  • Index(es):
    • Date
    • Thread