• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Looking at self = [super init].
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Looking at self = [super init]. (From: Alex Zavatone <email@hidden>)
 >Re: Looking at self = [super init]. (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Looking at self = [super init]. (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Looking at self = [super init].
  • Next by Date: Re: Looking at self = [super init].
  • Previous by thread: Re: Looking at self = [super init].
  • Next by thread: Re: Looking at self = [super init].
  • Index(es):
    • Date
    • Thread