Re: [self init] vs. [super init] in initWithCoder
Re: [self init] vs. [super init] in initWithCoder
- Subject: Re: [self init] vs. [super init] in initWithCoder
- From: John McLaughlin <email@hidden>
- Date: Fri, 18 Aug 2006 12:53:36 -0700
Hi All,
The consensus seems to be to have a private init function
('setDefaults') and then all of your inits' can call that. Seems a
reasonable approach that is certainly maintanable but a large part of
me still wonders that unless you need to call the parents
initWithCoder or unless you are doing something in your init that is
painful (time or resource wise) the most elegant solution would still
be to call [self init] first -- It guarantees an object's starting
point is the same whether loaded from a coder or instantiated brand
new and it really (again, to me) has a certain elegance to it.
Anyway again thanks for the response.
-John
On Aug 17, 2006, at 8:42 PM, Ricky Sharp wrote:
Finally, for other non-archived attributes, or other things that
need to be set up, why not create a separate method (e.g.
setDefaults) and call it from both initWithCoder and your various
other init methods?
John McLaughlin
http://www.loghound.com
email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden