I have the following Dog.h and Dog.m and getting the error in the title. How can I change the code to get this to work?? Would really appreciate some insight!
#import <Foundation/Foundation.h>
@interface Dog : NSObject
@property int age;
-(void) setAge: (int) value;
-(int) returnAge;
@end
#import "Dog.h"
@implementation Dog
@synthesize age;
-(void) setAge: (int) value
{
age = value;
}
-(int) returnAge
{
return age;
}
@end
The
_agevariable should only be used in the getter and setter methods. If you access the variable elsewhere in the .m file you should useageorself.age. And from outside the .m file you should usedog.age.