Re: Subclass of NSMutableArray isn't working
Re: Subclass of NSMutableArray isn't working
- Subject: Re: Subclass of NSMutableArray isn't working
- From: String <email@hidden>
- Date: Wed, 10 Mar 2004 12:01:18 -0600
On Mar 10, 2004, at 10:44 AM, Jamie Griffin wrote:
If the Graph class that you are making is intended to be used by
other objects as an Array (in other words external objects are
calling the count, addObject:, objectAtIndex:, etc methods directly)
then maybe you really do want an NSMutableArray subclass.
I'm afraid that's exactly what I want. The outside world makes
considerable use of NSMutableArray methods on Graph objects. I
basically want a Graph to be an NSMutableArray with some additional
methods (but no additional data), which seems like the perfect case
for a subclass.
I have read up on class collections and have created my own data
representation (an NSMutableArray inside) and overridden the primitive
class and instance methods (I simply pass the buck for all, ex: -count
has the implementation: return [internalArray count]). Now the class
works as an NSMutableArray and responds to inherited methods but does
not respond to my own instance methods. Any ideas?
Why are you overriding all the 'primative' methods if you are 'just
passing the buck' ?
Did you create a class that is a subclass of NSMutableArray ?
Can you send the code ? Must be something in the way you implemented
the subclass.
I am open to the alternative of creating an NSObject subclass with an
internal array. However, to do this I would need to find a way of
passing messages to the array if my class does not respond to them
(kind of like a subclass does naturally...). Would a delegate be
appropriate?
I doubt that is necessary.
Send me your .h and .m and the code fragment you are using to
instantiate the object.
-Jamie Griffin
"Darmok at Tenagra, Darmok and Gelad on the ocean."
<email@hidden><email@hidden>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.