Re: What classes have -init?
Re: What classes have -init?
- Subject: Re: What classes have -init?
- From: Quincey Morris <email@hidden>
- Date: Thu, 11 Feb 2010 21:52:50 -0800
On Feb 11, 2010, at 21:19, Michael Ash wrote:
> You override the one that's documented to be the designated initializer.
Or, all of the ones that are documented to be the designated initializers, since classes are allowed to have multiple designated initializers.
The point I tried to make earlier in this thread is that there's a very simple rule:
A class's implementation must "cover" *every* designated initializer of its superclass. Period.
[As a particular case of that rule, every subclass of NSObject must "cover" init.]
Therefore, it is *never* necessary for a client to consider what are the designated initializers of the superclass, when considering how to initialize an object of a class it wants to instantiate.
[As a matter of implementation detail, a subclass may "cover" a super initializer by overriding it, to modify its behavior or to disallow its use. Or it may choose not to override it, effectively making the superclass's designated initializer also one of its own designated initializers. But this is just an implementation detail. Clients of the class can't tell and don't care, beyond knowing what are the documented designated initializers.]
_______________________________________________
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