I have a small class hierarchy where I would like to have a child class be a property of it's parent class and all related subclasses. Essentially,
- I have
AbstractClass
with a property ofGroupClass
. GroupClass
is a child ofAbstractClass
.UsableObjectClass
is a child ofAbstractClass
and usesGroupClass
.
If I do the following...
#import <Cocoa/Cocoa.h>
#import "GroupingClass.h" // I've bounced this between @class as well.
@interface myAbstractClass : NSObject {
GroupingClass* parentGroup;
}
@property (readwrite, assign) GroupingClass* parentGroup;
@end
#import "myAbstractClass.h" // ERROR LOCATION
@implementation myAbstractClass
@synthesize parentGroup;
@end
#import <Cocoa/Cocoa.h>
@interface GroupingClass : myAbstractClass {
}
@end
#import <Cocoa/Cocoa.h> // ERROR LOCATION IN ALL CHILD CLASSES OF AbstractClass
@interface GroupingClass : myAbstractClass {
}
@end
...I get this funky "Line Location GroupingClass.h:3: error: cannot find interface declaration for 'myAbstractClass', superclass of 'GroupingClass'
" at the noted error locations.
I've tried various ways of getting this to work (yes, I know the above is totally wrong), Categories and Protocols seems the be right direction but this is becoming only so much flailing around now, and I really just need a shove in the right direction. I think I'm missing something grossly fundamental (frankly, I'm a little embarrassed to be asking this question).
I'm currently porting this application from REALbasic and something like this was a breeze; I could just add the property as the child class and it just worked. Objective-C...not so much.
Any help, even just a hint, is greatly appreciated!