• 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
Proper subclassing of NSMutableArray?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proper subclassing of NSMutableArray?


  • Subject: Proper subclassing of NSMutableArray?
  • From: Darrin Filer <email@hidden>
  • Date: Sat, 2 Feb 2002 16:30:22 -0500

I can't seem to properly subclass NSMutableArray. The following lines are used to declare and initialize:
DFArrayWithNames *versionArray;
theArray = [[DFArrayWithNames alloc] initWithCapacity:0];

This code produces the following error at runtime:
*** initialization method -initWithCapacity: cannot be sent to an abstract object of class DFArrayWithNames: Create a concrete instance!

The subclass has the following in its interface file:
#import <Foundation/NSArray.h>
@interface DFArrayWithNames : NSMutableArray
{
}
- (unsigned)indexOfObjectWithName:(NSString*)aName;
- (unsigned)indexOfObjectWithname:(NSString*)aName inRange:(NSRange)range;
- (id)objectWithName:(NSString*)aName;
@end

I know I'm missing something simple here... any pointers?

For those interested, the class is being used in an NSDataSource. Dictionaries don't preserve the order of contained objects yet I still need key-like access to the array's contents. Since key-based retrieval speed isn't critical, subclassing an NSMutableArray seemed best.

darrin filer


  • Prev by Date: Re: OpenGL problem
  • Next by Date: Re: optimizing compilers
  • Previous by thread: Re: Saving a RTFD-file with NSAttributedString
  • Next by thread: Firing an NSTimer by hand
  • Index(es):
    • Date
    • Thread