Re: Looking at self = [super init].
Re: Looking at self = [super init].
- Subject: Re: Looking at self = [super init].
- From: Simone Tellini <email@hidden>
- Date: Fri, 29 May 2015 19:47:55 +0200
> Il giorno 29/mag/2015, alle ore 19:38, Alex Zavatone <email@hidden> ha scritto:
>
> DOH. Good catch. Sorry, was typing out by hand instead of copying and pasting. I'm actually returning nil in the real class.
>
> So, that should be this:
>
> - (id)init {
> if (self != [super init]) {
> return nil;
> }
>
> // Set up stuff here.
> // We don't care if this gets long.
> // We really don't. This could go on and on.
>
> return self;
> }
what if [super init] returned something different than self, yet not nil?
In that case, your code wouldn’t be correct, as a general rule...
--
Simone Tellini
http://tellini.info
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden