Re: Properly writing an Init method
Re: Properly writing an Init method
- Subject: Re: Properly writing an Init method
- From: Julian Barkway <email@hidden>
- Date: Thu, 18 Jul 2002 06:35:49 +0200
On Wednesday, July 17, 2002, at 10:37 pm, Ondra Cada wrote:
On Wednesday, July 17, 2002, at 08:24 , Julian Barkway wrote:
The above discussion is very interesting but there's also another
point in the example code. I have often wondered about the merits of
'self = [super init]'. Surely this means that 'self' effectively
becomes typed to the superclass rather than the class itself?
'Course not. This is dynamic type system, not a static one.
Fair point. So what are the benefits of assigning to self in this way,
rather than using, say,
if (![super init])
return nil;
// Init stuff...
return self;
I'm only asking because I recently had a problem which was caused by an
object being typed to it's own superclass, rather than the class it
should have been typed to, and it struck me this could have been caused
by my use of 'self = [super init]'...
--
Julian Barkway,
Zurich,
Switzerland.
_______________________________________________
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.