• 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: Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed)


  • Subject: Re: Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed)
  • From: Fritz Anderson <email@hidden>
  • Date: Thu, 28 Jul 2005 17:39:01 -0500

On 27 Jul 2005, at 7:37 PM, Jim Correia wrote:

The runtime system sends an initialize message to every class object
before the class receives any other messages and after its superclass
has received the initialize message. [...]
...

But more importantly:

Note: Remember that the runtime system sends initialize to each class
individually. Therefore, in a class’s implementation of the initialize
method, you must not send the initialize message to its superclass.

As I read it (and my experience does not contradict this), when you first use an Employee method, +initialize is sent to Employee, and serially to each member of its superclass chain, serially from the top superclass down. Members of the chain that don't implement +initialize pass their instance of the call up the inheritance chain, which can result in a superclass of such a class getting +initialize additional times.


So on first use of Employee, +initialize is sent to Person, and then to Employee (which if it doesn't implement +initialize, amounts to triggering Person's initialize on the instance [Employee class]).

    -- F

_______________________________________________
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


  • Follow-Ups:
    • Re: Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed)
      • From: Jim Correia <email@hidden>
References: 
 >Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed) (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Completely stuffed adding a new column to an NSOutlineView
  • Next by Date: Re: Core Data performance (was: Newbie Help understanding Core Data)
  • Previous by thread: Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed)
  • Next by thread: Re: Bindings: Where/when should dependent keys be registered? (when class with dependent keys is subclassed)
  • Index(es):
    • Date
    • Thread