Re: design problem
Re: design problem
- Subject: Re: design problem
- From: Kurt Revis <email@hidden>
- Date: Wed, 13 Feb 2002 18:19:18 -0800
On Wednesday, February 13, 2002, at 06:05 PM, email@hidden
wrote:
Hello everybody!
I have a header file interdependency. A.h imports B.h and B.h imports
A.h. Of course, that is not possible, so I am using @class A. The other
way around is to use id, however that would add overhead, and I don't
want that (since there is a more elegant way of doing it).
Using id does not add any overhead to the running program. Static typing
in Objective-C is only used at compile time.
I get a bunch of warnings because the compiler can not find the
selectors (apparently since one of the header file is not imported). Is
there any way to tell the compiler of the existence of those selectors?
Um, import the header file when you need to?
As tersely as possible:
A.h:
@class B;
@interface A : NSObject {
B *myB;
}
- (void)myAMethod;
@end
B.h:
@class A;
@interface B : NSObject {
A *myA;
}
- (void)myBMethod;
@end
A.m:
#import "A.h"
#import "B.h"
@implementation A
- (void)myAMethod
{
}
@end
B.m:
#import "B.h"
#import "A.h"
@implementation B
- (void)myBMethod
{
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.