• 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: Super vs. self (newbie question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Super vs. self (newbie question) (From: Jonas Roel <email@hidden>)

  • Prev by Date: Super vs. self (newbie question)
  • Next by Date: Re: NSMatrix Questions
  • Previous by thread: Super vs. self (newbie question)
  • Next by thread: Re: Super vs. self (newbie question)
  • Index(es):
    • Date
    • Thread