• 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: [Q] Inheritance, Composition and Abstract super classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >[Q] Inheritance, Composition and Abstract super classes (From: "Peter.Teeson" <email@hidden>)

  • Prev by Date: Re: @synchronized question
  • Next by Date: Copy/Paste not working from keyboard
  • Previous by thread: Re: [Q] Inheritance, Composition and Abstract super classes
  • Next by thread: Setting NSImageView back to default
  • Index(es):
    • Date
    • Thread