Class Cluster Confusion
Class Cluster Confusion
- Subject: Class Cluster Confusion
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Thu, 19 Jun 2003 13:56:42 +0200
NSFileManager *defaultManager = [ NSFileManager defaultManager ];
id dirContent = [ defaultManager directoryContentsAtPath: aPath ];
NSLog(@"dirContent class: \"%@\"", [ dirContent class ] );
// class is NSCFArray, which is also what the documentation tells me.
// this is a method of NSMutableArray, not of NSArray:
[ dirContent removeObjectAtIndex: 0 ] ;
Now I would expect a run-time error: "-[NSCFArray
removeObjectAtIndex:]: selector not recognized", but it just works.
Why?
// Then I did:
NSMutableArray *mutants = [ [ NSMutableArray alloc ] initWithCapacity:
count ] ;
NSLog(@"mutants class: \"%@\"", [ mutants class ] );
// class is again NSCFArray
Does this mean that there is no such thing as a NSMutableArray? That
this is always the same as NSArray? That the distinction is only for
static type checking?
Or what am I misunderstanding here?
Gerriet.
_______________________________________________
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.