Re: Inheritance question
Re: Inheritance question
- Subject: Re: Inheritance question
- From: Chris Hanson <email@hidden>
- Date: Fri, 17 Aug 2007 14:13:12 -0700
On Aug 17, 2007, at 3:41 AM, Daniel Angermeier wrote:
Ok, this would work for that particular case, but what if I have an
instance of MyClass and want to call a super method on it.
The thing to remember is that you're not calling a method on an
instance of a class. You're sending a message to an instance of a
class. What the instance does with that message is up to it;
typically the runtime calls a method to deal with it, though there are
other ways an instance can deal with a message that are entirely
transparent to the sender. (Take Distributed Objects proxies for
example, or -forwardInvocation:.)
If an instance of a class wants to handle a particular message,
chances are that you should let it handle the message rather than try
to second-guess it. You never know what invariants you may otherwise
cause it to violate otherwise.
-- Chris
_______________________________________________
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