Cocoa Import Controllers Model, Import Models Controller & # 8594; An exception
Why isn't it possible in Cocoa for two classes to import each other? I tried the following code:
controller.h:
#import <Cocoa/Cocoa.h>
#import "Model.h"
@interface Controller : NSObject {
Model *model;
}
@end
model.h:
#import <Cocoa/Cocoa.h>
#import "Controller.h"
@interface Model : NSObject {
Controller *controller;
}
@end
which throws the following exceptions:
error: expected specifier-qualifier-list before 'Controller'
error: expected specifier-qualifier-list before 'Model'
Can someone explain why this is?
Thanks! xonic
+2
a source to share