On Mon, Jul 13, 2009 at 12:53 PM, I. Savant wrote:
> On Jul 13, 2009, at 12:41 PM, Quincey Morris wrote:
>
>> What you *don't* get for free from subclassing is an internal storage
>> mechanism -- you have to invent that for yourself (usually by putting a real
>> NSArray instance variable in your su
On Jul 13, 2009, at 12:41 PM, Quincey Morris wrote:
What you *don't* get for free from subclassing is an internal
storage mechanism -- you have to invent that for yourself (usually
by putting a real NSArray instance variable in your subclass :) ).
You also need a pretty clear understanding
On Jul 13, 2009, at 08:49, I. Savant wrote:
Subclassing is fraught with many angry, fire-breathing, treasure-
grubbing dragons and as such is *not* recommended.
On Jul 13, 2009, at 08:51, David W. Berry wrote:
NSMutableArray (and most/all of the collection classes) is an
abstract class that
On Jul 13, 2009, at 12:02 PM, Gideon King wrote:
The array retains it, so [NSMutableArray arrayWithObject:[[[MyClass
alloc] init] autorelease]]; would be better.
Yes, I saw that after I'd sent it but didn't think it worth another
e-mail. It's fine if you're using GC . :-D
--
I.S.
What's wrong with [[NSMutableArray arrayWithObject:[[MyClass alloc]
init]]; ?
The array retains it, so [NSMutableArray arrayWithObject:[[[MyClass
alloc] init] autorelease]]; would be better.
HTH
Gideon
___
Cocoa-dev mailing list (Cocoa-dev@l
NSMutableArray (and most/all of the collection classes) is an abstract
class that can't be usefully sub-classed. The object returned by
[NSMutableArray array] is actually a subclass of NSMutableArray. Your
best approach is probably to check out categories which can be used to
add methods
On Jul 13, 2009, at 11:44 AM, DKJ wrote:
I've subclassed an NSMutableArray, and I want it to be initialised
with some objects already in place. So I did this:
...
I suspect I'm missing something simple here.
Yes:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/n
I've subclassed an NSMutableArray, and I want it to be initialised
with some objects already in place. So I did this:
- (id) init
{
self = [super init];
if (self != nil) {
for( int i = 0; i < 3; i++ )
[self addObject:[[[my