[Objective-C] Primitive question, (void) init method.
- by user354289
Hi, I have a question in Objective-C.
I'm using init method Apple recommended style.
- (id)initMyClass: (int)a
{
if (self = [super init])
{
// a...
}
return self;
}
Init method returns own object pointer. Then, if the object will not be refered from any objects, can empty return method(void) be better?
- (void)initMyClass: (int)a
{
if ([super init] != nil)
{
// a...
}
}
I want to know about that, if init method doesn't return self, what problem will occur?