Proper subclassing of NSMutableArray?
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