Is this code correct
Why use [self class]
I thought self already points to the class on static methods (the ones with +)
Code:
@implementation Vehicle +(id) vehicleWithColor:(NSColor*)color {
id newInstance = [[[self class] alloc] init]; // PERFECT, the class is // dynamically identified
[newInstance setColor:color]; return [newInstance autorelease];
} @end
Why use [self class]
I thought self already points to the class on static methods (the ones with +)