Re: Problem with object communication
Re: Problem with object communication
- Subject: Re: Problem with object communication
- From: Ferdinand Svehla <email@hidden>
- Date: Sat, 30 Nov 2002 20:09:00 +0100
Thankyou very much, Fritz!
You're solution worked perfectly for me - this was really giving me a
headache.
I am still unsure if my approach in dividing my application in serveral
parts and only let them talk together through the MainController is a
good one - but it is working now - thanks to you!
Am Samstag, 30.11.02, um 19:56 Uhr (Europe/Vienna) schrieb Fritz
Anderson:
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.
_______________________________________________
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.