• 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: Properly writing an Init method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Properly writing an Init method
      • From: Ondra Cada <email@hidden>
    • Re: Properly writing an Init method
      • From: jerome LAURENS <email@hidden>
References: 
 >Re: Properly writing an Init method (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Re(2): [Seriously OT]Mac.com 60 days and counting
  • Next by Date: [ANN] Sphaera released
  • Previous by thread: Re: Properly writing an Init method
  • Next by thread: Re: Properly writing an Init method
  • Index(es):
    • Date
    • Thread