I’m subclassing a class.
I’m overriding a init method. This one: -(id)initWithSomething:(Something*)somet;
this would look like this (in the subclass)
-(id)initWithSomething:(Something *)somet with:(int)i{
if (self = [super init]) {
//do something
}
return self;
}
But now I want to call the init in the superclass too.
How would I now do this? Mayby this way?
-(id)initWithSomething:(Something *)somet with:(int)i{
if (self = [super init]) {
}
[super initWithSomething:somet];
return self;
}
Typically like this:
It’s the responsibility of super to call the vanilla init selector if it needs to.