RS: declaration bug
RS: declaration bug
- Subject: RS: declaration bug
- From: Roland Silver <email@hidden>
- Date: Wed, 22 Aug 2007 20:32:16 -0600
In the two skeleton classes defined below, I get an error message
flagged for the second line of Foo.m:
#include "Foo.h"
error: cannot find interface declaration for 'Foo', superclass of 'Bar'
If I comment out that line, I get both an error message and a warning
on the fourth line:
error: parse error before 'Bar'
warning: cannot find interface declaration for 'Foo'
But Bar needs to know about its superclass, Foo, and Foo needs to
know about Bar because of the declaration (and definition) of its bar
method.
So how do I handle this?
---------------------------------------------------
// Foo.h
#import <Cocoa/Cocoa.h>
#import "Bar.h"
@interface Foo : NSObject {}
- (Bar*) bar;
@end
// Foo.m
#import "Foo.h"
@implementation Foo
- (Bar*) bar {
Bar* aBar;
return aBar; }
@end
// Bar.h
#import <Cocoa/Cocoa.h>
#import "Foo.h"
@interface Bar : Foo {}
@end
// Bar.m
#import "Bar.h"
@implementation Bar
@end
---------------------------------------------------
-- Roland Silver <email@hidden>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden