Re: Issues with Inheritance and collections?
Re: Issues with Inheritance and collections?
- Subject: Re: Issues with Inheritance and collections?
- From: Ken Thomases <email@hidden>
- Date: Fri, 30 Jan 2009 19:51:34 -0600
On Jan 30, 2009, at 5:23 AM, Devraj Mukherjee wrote:
I have two classes DomainLogicBase and Vehicle where Vehicle inherits
from DomainLogicBase [...]
I am adding objects of type Vehicle to an NSMutableArray which are
read up from disk from an SQLite database.
How are you storing/reading them? Are you sure they are complete and
valid at this point?
When I try and get the object back out of the NSMutableArray and
access its properties my app crashes. I have tried to use the debugger
and the best I can tell is the properties seem to have invalid values.
If the model class does not inherit from a custom class I have defined
then the app works fine.
Is there something I am missing? Does inheritance do funny things when
I am adding objects of the children class to a collection?
No, inheritance doesn't do "funny things" when you add the objects to
a collection.
Is DomainLogicBase derived, directly or indirectly, from NSObject?
You might have accidentally forgotten to specify its super class, thus
inadvertently making it a root class.
If that's not it, then I suspect memory management problems. You
might be over-releasing the objects and the memory is later reused for
some other kind of object. Try turning on NSZombieEnabled.
Regards,
Ken
_______________________________________________
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