Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!portal!cup.portal.com!dbw From: dbw@cup.portal.com (Dale B Walker) Newsgroups: comp.sys.mac.programmer Subject: Re: Circular Referencing Think C Classes Message-ID: <33634@cup.portal.com> Date: 7 Sep 90 21:13:53 GMT References: Distribution: na Organization: The Portal System (TM) Lines: 53 You Write: >What do I need to do in order to let two classes "talk" to each other. >It took me awhile to figure out that this was my problem. Is there >some sort of forward declaration for classes (class structs) >referenced in this way. In your examples you have two .h files that include each other. I encountered the same problem. My solution was to have only one of the files include the other - and in the case of the second file, use the superclass of the desired class and cast it as necessary in the c code defining the methods. Dale Example: /* Class1.h */ #define _H_Class1 #include struct Class1 : indirect { CObject *three; void doit (void); }; ------------------------------- /* Class3.h */ #define _H_Class3 #include #include "Class1.h" struct Class3 : CObject { Class1 *one; void doit (void); }; -------------------------------- /* Class1.c */ #include "Class1.h" #include "Class3.h" void Class1::doit() { ((Class3 *) three)->doit(); }