• 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: What classes have -init?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What classes have -init?


  • Subject: Re: What classes have -init?
  • From: Graham Cox <email@hidden>
  • Date: Fri, 12 Feb 2010 15:28:30 +1100

On 12/02/2010, at 1:43 PM, Gordon Apple wrote:

> My point was that if all Cocoa classes called "init"
> somewhere in their other initializers (or had a two-step initialization
> similar to what MacApp did), then you could simply override (not call)
> "init" for simple ivar initialization in a subclass, which would in no way
> interfere with a designated initializer.


Except that it would be all too easy to create an infinite loop. A subclass might implement -init to call super's designated initializer, which later calls -init.

I'm not sure what's complex about overriding the designated initializer - even if it has a complex set of parameters, (and most do not) then all you do is pass them up to super. Your suggestion would only save a tiny, tiny amount of work yet lead to potentially big problems.

--Graham


_______________________________________________

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

  • Follow-Ups:
    • Re: What classes have -init?
      • From: Charles Srstka <email@hidden>
References: 
 >Re: What classes have -init? (From: Gordon Apple <email@hidden>)

  • Prev by Date: Re: Creating an Application Support folder
  • Next by Date: Re: Creating an Application Support folder
  • Previous by thread: Re: What classes have -init?
  • Next by thread: Re: What classes have -init?
  • Index(es):
    • Date
    • Thread