Re: Subclass of NSMutableArray isn't working
Re: Subclass of NSMutableArray isn't working
- Subject: Re: Subclass of NSMutableArray isn't working
- From: Jamie Griffin <email@hidden>
- Date: Wed, 10 Mar 2004 11:44:28 -0500
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?
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?
-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.