Re: Super vs. self (newbie question)
Re: Super vs. self (newbie question)
- Subject: Re: Super vs. self (newbie question)
- From: Nathan Day <email@hidden>
- Date: Sun, 11 Aug 2002 02:13:59 +0930
super lets you start the search for a method in the parent class instead
of self, an example
- (void)foo
{
[self foo];
}
the search for foo start in self, self implements foo and so it's
invoked and a infinite loop occurs, foo invokes foo which invokes foo
which invokes
- (void)foo
{
[super foo];
}
this is ok, the search for foo starts in the parent class instead of
self. You can use super to call a different method from within foo, but
this is fairly rare.
On Sunday, August 11, 2002, at 01:44 AM, Jonas Roel wrote:
Can someone differentiate between self and super? Does self ONLY refer
to the method contained in the class, and super ONLY refers to the
class which contains such and such methods which is calling super?
Thanks -M
_______________________________________________
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.
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
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.