Skip navigation.
 
mlRe: Problem with object communication
FROM : Fritz Anderson
DATE : Sat Nov 30 19:56:26 2002

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_removed>>
Risumi:    <http://resume.manoverboard.org>
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlProblem with object communication Ferdinand Svehla Nov 30, 18:42
mlRe: Problem with object communication Fritz Anderson Nov 30, 19:56
mlRe: Problem with object communication Ferdinand Svehla Nov 30, 20:09