Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!ukma!rex!samsung!uakari.primate.wisc.edu!umriscc!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!usenet From: dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) Newsgroups: comp.sys.mac.programmer Subject: Think C #include Question Message-ID: <1991Feb28.223430.24645@ux1.cso.uiuc.edu> Date: 28 Feb 91 22:34:30 GMT Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 43 I am working with 3 classes (call them Foo, Bar, and Baz). Foo and Bar are subclasses of Baz. There header files are as follows: -----------Foo.h----------- #define _H_Foo /* prevents file from being included more than once */ #include Baz.h /* superclass header */ #include Bar.h /* other file's header */ struct Foo : Baz { Bar *myBar; /* an object of the Bar class */ . . }; ----------Bar.h------------ #define _H_Bar #include Baz.h #include Foo.h struct Bar : Baz { Foo *myFoo; /* an object of the Foo class */ . . }; --------------------------- The problem is that I want each Foo to know about a Bar, and I want each Bar to know about a Foo. Unfortunately I get a syntax error when I try to compile. When compiling Bar.h, it first has to compile Foo.h. When Foo.h tries to declare myBar, it can't because the Bar class has not been; thus I get a syntax error. How can I get around this problem? -- David M. Marcovitz | internet: marcovitz@uiuc.edu Computer-based Education Research Lab | dmmg1176@uxa.cso.uiuc.edu University of Illinois | novanet: marco / cca / cerl