Subclassing NSArray
Subclassing NSArray
- Subject: Subclassing NSArray
- From: Timothy Larkin <email@hidden>
- Date: Sun, 15 Sep 2002 09:00:00 -0400
I am having difficulty subclassing NSArray. The subclass does not
inherit NSArray's methods. For instance, if MyThing is a subclass of
NSArray, and A is an instance of MyThing, then [A count] produces an
execution error that says:
2002-09-15 08:54:39.158 ArrayTest[14121] *** Uncaught exception:
<NSInvalidArgumentException> *** -count only defined for abstract
class. Define -[MyThing count]!
From this I gather that 'count' is defined only for the NSArray
abstract class, and that a subclass of NSArray is expected to be a
concrete class that explicity implements 'count'. However, I don't want
to create an entire concrete class; I just want to subclass and add a
few methods.
Is subclassing NSArray impossible? Do I need to use categories instead?
--
Timothy Larkin
Abstract Tools
Caroline, NY
_______________________________________________
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.