I have two subclasses, one that has a lot of customization, we'll call it Foo, and another sub class that only needs 1 method overridden, and doesn't need any additional variables, we'll call it Bar.
Bar will be one of the variables of Foo, so to keep from having 2 more files to work with (.m and .h for Bar) I would like to interface and implement Bar in Foo's .h and .m files.
My best effort gives me several compiler errors.
The .h file looks like:
#import <UIKit/UIKit.h>
@interface Foo : FooSuperClass {
Bar *barVariable;
}
@property (nonatomic, retain) Bar *barVariable;
-(void) fooMethod;
@end
@interface Bar : BarSuperClass {
}
@end
The .m file looks like:
#import "Foo.h"
@implementation Foo
@synthesize barVariable;
-(void) fooMethod{
//do foo related things
}
@end
@implementation Bar
- (void)barSuperClassMethodIWantToOverride{
}
@end
I realize that this type of things would generally be frowned upon, but I feel it's appropriate in my situation. The first error I get is "expected specifier-qualifier-list before Bar".
What have I done wrong, I'm pretty sure it's possible to have multiple declarations/definitions in a single file.