Re: Calling class methods from other class methods
Re: Calling class methods from other class methods
- Subject: Re: Calling class methods from other class methods
- From: Jeff Disher <email@hidden>
- Date: Fri, 7 Feb 2003 00:02:20 -0500
On Thursday, February 6, 2003, at 11:33 PM, Ken Tozier wrote:
Given a class MyClass with two class methods, the first:
+ (BOOL) method1:(unichar) inChar
{
/* do stuff here */
}
Which of the following is the correct way to call class method 1 from
class method 2?
+ (BOOL) method2:(unichar) inChar
{
return [self method1:inChar];
}
This is the correct one since it will still work properly if someone
overrides the class method in a sub-class. I do remember someone
saying that there was another issue which implied you should do it like
this:
return [[self class] method1:inChar];
I am not sure of the details, however, since I haven't played around
with class method inheritance aside from the extent to which that is
used in basic class cluster designs.
Hope that helps,
Jeff Disher
President and Lead Developer of Spectral Class
Spectral Class: Shedding Light on Innovation
http://www.spectralclass.com/
_______________________________________________
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.