• 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
Subclassing NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Subclassing NSArray
      • From: email@hidden
    • Re: Subclassing NSArray
      • From: David Remahl <email@hidden>
  • Prev by Date: Re: Text file encryption
  • Next by Date: Re: Subclassing NSArray
  • Previous by thread: Transparency Problems
  • Next by thread: Re: Subclassing NSArray
  • Index(es):
    • Date
    • Thread