Re: Objective-C Question
Re: Objective-C Question
- Subject: Re: Objective-C Question
- From: Dave <email@hidden>
- Date: Tue, 12 Mar 2013 07:59:54 +0000
On 11 Mar 2013, at 21:14, Mike Abdullah wrote:
if from an instance + Method I do:
[super someMethod], then surely it's an error because this isn't
an instance?
It *is* an instance. An instance of the *metaclass*. This is where
you're deep into the guts of Objective-C :)
Hmmmm, I think I kind of knew this already but the details were
fuzzy. Ok, i understand what you mean, so is the following correct:
1. In a Instance - method, if you do [self someMethod] it will call -
someMethod in the current class if it is defined there, or it will
call -someMethod, in one of the parents of the current instance or
error if -someMethod is not defined. If -someMethod is defined, and
it calls [self -someMethod] then it will call as high up the chain as
possible, e.g. will find -someMethod in one of the subclasses if it
is defined or it will call it's own version?
e.g.
BaseClass <--- Subclass1 <--- Subclass2 <--- Subclass3
-someMethhod <--------------------------- Subclass2 <--- Subclass3
_______________________________________________
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