home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / next / programm / 5353 < prev    next >
Encoding:
Internet Message Format  |  1992-07-30  |  1.1 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!unido!nextpoint!dev01
  2. From: hans@dev01 (Hans Peter Geiser)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Re: class messages
  5. Message-ID: <1684@nextpoint.UUCP>
  6. Date: 30 Jul 92 08:07:50 GMT
  7. References: <Bs4s27.IJE@gpu.utcs.utoronto.ca>
  8. Sender: usenet@nextpoint.UUCP
  9. Lines: 32
  10.  
  11. > This may seem like a dumb question, but how do you call a method in a
  12. > CustomClass from another method in the same CustomClass??
  13. > Eg.
  14. >               CustomClass has 2 methods.
  15. >               - helloThere
  16. >               - seeYouTommorow
  17. >               When I'm in, or done with, helloThere, how can I call
  18. >               seeYouTommorow from within helloThere?
  19.  
  20. As you name your methods - hello.. ( and not + hello...) I suppose you don't  
  21. mean messages that are sent to Classes but messages to objects.
  22.  
  23. This is easy done by using the global id self, that points always to the object  
  24. of the method you're in. Just do the following:
  25.  
  26. - helloThere
  27. {
  28.     ....
  29.     [self seeYouTomorrow];
  30.     ...
  31.     return self;
  32. }
  33. - seeYouTomorrow
  34. {
  35.     ....
  36.     return self;
  37. }
  38.  
  39. Hans - Peter Geiser
  40.