Article View: comp.sys.next.programmer
Article #344Re: class messages
From: Hans Peter Geiser
Date: Thu, 30 Jul 1992 08:07
Date: Thu, 30 Jul 1992 08:07
32 lines
1137 bytes
1137 bytes
> 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
Technical Details
Message-ID:
<1684@nextpoint.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!unido!nextpoint!dev01References:
<Bs4s27.IJE@gpu.utcs.utoronto.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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