• 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: sending a message from an initializer method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sending a message from an initializer method


  • Subject: Re: sending a message from an initializer method
  • From: Uli Kusterer <email@hidden>
  • Date: Thu, 13 Jan 2011 19:19:31 +0100

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

  • Follow-Ups:
    • Re: sending a message from an initializer method
      • From: Erik Buck <email@hidden>
References: 
 >Re: sending a message from an initializer method (From: Gordon Apple <email@hidden>)
 >Re: sending a message from an initializer method (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: QuickLook returning small image
  • Next by Date: Re: data over USB to iPhone
  • Previous by thread: Re: sending a message from an initializer method
  • Next by thread: Re: sending a message from an initializer method
  • Index(es):
    • Date
    • Thread