Re: sending a message from an initializer method
Re: sending a message from an initializer method
- Subject: Re: sending a message from an initializer method
- From: Erik Buck <email@hidden>
- Date: Thu, 13 Jan 2011 17:27:53 -0500
Fair enough.
On Jan 13, 2011, at 1:19 PM, Uli Kusterer wrote:
> On Jan 13, 2011, at 1:27 AM, Erik Buck wrote:
>> Class or instance method makes no difference in this case with regard to polymorphism.
>
> It does. He's only passing the two instance variables to the class method. And, being a class method, "self" is the class, not the half-initialized instance.
>
> So what using a class method does, is it makes it possible for subclasses to change the computation by overriding the method (assuming he's using [[self class] compute:...] to call the class method, and doesn't hardcode the class name). However, since it's a class method, subclasses can't accidentally mess with the half-initialized object.
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
>
>
>
_______________________________________________
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