Why do I get, "fatal error: method definition not in #implementation context" when I declare the methods in AppController.h, but not when I do not declare the methods?
#import <Cocoa/Cocoa.h>
@interface AppController : NSObject {
int fido;
}
@end
-(int)fido;
-(void)setFidoint)x;
@implementation AppController
-(id)init
{
[super init];
[self setValue:[NSNumber numberWithInt:5]
forKey"fido"];
NSNumber *n = [self valueForKey"fido"];
NSLog(@"fido = %@",n);
return self;
}
-(int)fido
{
NSLog(@"-fido is returning %d", fido);
return fido;
}
-(void)setFidoint)x
{
NSLog(@"-setFido: is called with %d", x);
fido = x;
}
@end
#import <Cocoa/Cocoa.h>
@interface AppController : NSObject {
int fido;
}
@end
-(int)fido;
-(void)setFidoint)x;
@implementation AppController
-(id)init
{
[super init];
[self setValue:[NSNumber numberWithInt:5]
forKey"fido"];
NSNumber *n = [self valueForKey"fido"];
NSLog(@"fido = %@",n);
return self;
}
-(int)fido
{
NSLog(@"-fido is returning %d", fido);
return fido;
}
-(void)setFidoint)x
{
NSLog(@"-setFido: is called with %d", x);
fido = x;
}
@end