Hey everyone
I've been trying to teach myself objective-c for sometime now and I am following a book i bought. When i try to compile this little program it fails, can someone please tell me what is wrong.
I've been trying to teach myself objective-c for sometime now and I am following a book i bought. When i try to compile this little program it fails, can someone please tell me what is wrong.
Code:
#import <Foundation/Foundation.h>
@interface Mycombo: NSObject
{
int firstnumber;
int secondnumber;
int thirdnumber;
}
-(void) print;
-(void) setfirst: (int) x;
-(void) setsecond: (int) y;
-(void) setthird: (int) z;
@implementation Mycombo
-(void) print
{
NSLog(@"%i - %i - %i", firstnumber, secondnumber, thirdnumber);
}
-(void) setFirst: (int) x
{
firstnumber = x;
}
-(void) setSecond: (int) y
{
secondnumber = y;
}
-(void) seThird: (int) z
{
thirdnumber = z;
}
@end
int main (int argc, const char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Mycombo * combo = [[Mycombo alloc] init];
[combo setFirst: 10];
[combo setSecond: 22];
[combo setThird: 31];
NSLog (@"your new combo is:");
[combo print];
[combo release];
[pool drain];
return 0;
}