Reputation: 878
Sorry if this is a noob question, but if my designated initializer for my Base Class looks like
- (id)initWithName:(NSString *)name {
if (self = [super init]) {
_name = [name retain];
}
return self;
}
Now if I had a child class that inherits from this class and wanted to call that initializer, do I do:
- (id)initWithSomethingElse:(NSString *)somethingElse name:(NSString *)name {
if (self = [super initWithName:name]) {
_somethingElse = [somethingElse retain];
}
return self;
}
Upvotes: 0
Views: 64
Reputation: 73936
Yes, that's correct. You can call any of the superclass' initialisers, in fact.
Upvotes: 1