I'm trying to call methods on the parent of my object by passing the parent in as property. But i keep getting this error:
expected specifier-qualifier-list before 'Wheel'
@interface Car : NSObject {
Wheel *w;
}
- (void)doCarStuff;
@end
@implementation Car
- (id)init {
if((self = [super init])) {
//w = [[Wheel alloc] init];
//w.parent = self;
}
return self;
}
- (void)doCarStuff {
NSLog(@"Car stuff");
}
@end
@interface Wheel : NSObject {
Car *parent;
}
@property (nonatomic, assign) Car *parent;
@end
@implementation Wheel
@synthesize parent;
- (id)init {
if((self = [super init])) {
[parent doCarStuff];
}
return self;
}
@end
It is probably because i have to declare the Car before the Wheel and vise versa. I bet the solution is so simple i can't see it :P