[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to call?
From: |
Stefan Urbanek |
Subject: |
Re: How to call? |
Date: |
Wed, 05 Mar 2003 09:16:36 +0100 |
On 2003-03-05 08:43:12 +0100 Peter Karlsson <vigour@hotmail.com> wrote:
Hi dear list!
I have a problem. This is my interface file:
@interface reset : NSObject
{
}
- reset;
@end
This is my implementation file:
@implementation reset
- reset
{
printf("Hello Gnu People\n");
return self;
}
@end
The question is, how do I call reset? I tried just to type reset; and I got no
errors or warnings when building but the reset code is not called, seems to be
ignored. What am I doing wrong here?
In your case, 'reset' is a name of a class and also a name of a method. To call
that method, you have to create an instance of that class and send it the
message 'reset'.
main()
{
...
reset myObject = [[reset alloc] init]; /* create an instance */
[myObject reset]; /* send a message */
....
}
BTW. The naming convenience is that class names start with capital letter, so
it should be named Reset. But it is just a cosmetic thing.
Stefan
- How to call?, Peter Karlsson, 2003/03/05
- Re: How to call?,
Stefan Urbanek <=