Re: Problem with object communication
Re: Problem with object communication
- Subject: Re: Problem with object communication
- From: Fritz Anderson <email@hidden>
- Date: Sat, 30 Nov 2002 12:56:26 -0600
If MainController and MainWindowController depend on each other, the
way to avoid circular dependencies is to use the @class directive in
the header files, and import headers only in the implementation files.
The @class directive tells the compiler that the indicated symbol will
be used as a class name, with details to be supplied later.
=====
MainController.h:
#import <Cocoa/Cocoa.h>
@class MainWindowController;
@interface MainController : NSObject {
MainWindowController * window;
...
=====
MainWindowController.h:
#import <Cocoa/Cocoa.h>
@class MainController;
@interface MainWindowController : NSWindowController {
MainController * parent;
...
=====
MainController.m:
#import "MainWindowController.h"
@implementation MainController
....
=====
MainWindowController.m:
#import "MainController.h"
@implementation MainWindowController
....
-- F
On Saturday, November 30, 2002, at 11:42 AM, Ferdinand Svehla wrote:
The problem is that i get compiler errors (parse error before) - i
think it is because i include in MainController.h in
MainWindowController.h and MainWindowController.h in MainController.h
(so that the compiler knows which object is capable of doing what)
--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <
http://resume.manoverboard.org>
_______________________________________________
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.