Re: self
Re: self
- Subject: Re: self
- From: Andy Lee <email@hidden>
- Date: Wed, 8 Jun 2005 12:33:57 -0400
On Jun 8, 2005, at 11:39 AM, Mark Lively wrote:
On Jun 8, 2005, at 8:13 AM, Clark Cox wrote:
for example the code:
-(id) init {
self = [self initSpecial];
return self;
}
should alter everything in exactly the same way as:
-(id) init {
return [self initSpecial];
}
Yes.
Maybe.
If initSpecial calls [super init], some supers discard the original
object and return a new one.
I think you're confusing this with a different init pitfall. The
above two methods are in fact identical. In the first, *whatever* -
initSpecial returns (even if it's not the original receiver) will be
assigned to the local variable self, and that value will be
returned. In the second, *whatever* -initSpecial returns will be
returned immediately.
You might be thinking of the mistake some people make when they
separate the call to +alloc from the call to -init.
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >self (From: "Theodore H. Smith" <email@hidden>) |
| >Re: self (From: Clark Cox <email@hidden>) |
| >Re: self (From: Mark Lively <email@hidden>) |