home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!unido!nextpoint!dev01
- From: hans@dev01 (Hans Peter Geiser)
- Newsgroups: comp.sys.next.programmer
- Subject: Re: class messages
- Message-ID: <1684@nextpoint.UUCP>
- Date: 30 Jul 92 08:07:50 GMT
- References: <Bs4s27.IJE@gpu.utcs.utoronto.ca>
- Sender: usenet@nextpoint.UUCP
- Lines: 32
-
- > This may seem like a dumb question, but how do you call a method in a
- > CustomClass from another method in the same CustomClass??
- >
- > Eg.
- > CustomClass has 2 methods.
- > - helloThere
- > - seeYouTommorow
- >
- > When I'm in, or done with, helloThere, how can I call
- > seeYouTommorow from within helloThere?
- >
-
- As you name your methods - hello.. ( and not + hello...) I suppose you don't
- mean messages that are sent to Classes but messages to objects.
-
- This is easy done by using the global id self, that points always to the object
- of the method you're in. Just do the following:
-
- - helloThere
- {
- ....
- [self seeYouTomorrow];
- ...
- return self;
- }
- - seeYouTomorrow
- {
- ....
- return self;
- }
-
- Hans - Peter Geiser
-