Re: [Q] Inheritance, Composition and Abstract super classes
Re: [Q] Inheritance, Composition and Abstract super classes
- Subject: Re: [Q] Inheritance, Composition and Abstract super classes
- From: Chris Hanson <email@hidden>
- Date: Mon, 24 May 2004 11:12:03 -0700
On May 23, 2004, at 5:52 PM, Peter.Teeson wrote:
My questions are:
(0) Should any of the MyDocument definitions of overridden methods be
commented out?
Just don't implement them in your base class if you don't need to.
(1) If a method that is overridden in the MyDocument class is also
overriden in one of the child classes is my understanding correct that
it is the child class that receives the message and that the super
class method will NOT receive it unless explicitly invoked from the
child class?
Your understanding's correct.
An object or class is sent messages, and the instance or class methods
(respectively) defined in its class are invoked in response to those
messages. So if you have C inheriting from B inheriting from A, and
you send an instance of C a message like [myC doSomething] then the
lookup order for a method to handle the message is C, B, A.
-- Chris
--
Chris Hanson <email@hidden>
http://www.livejournal.com/users/chanson/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.