Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!snorkelwacker.mit.edu!bloom-beacon!vaxeline!bootsie!olson From: olson@bootsie.uucp (Eric K. Olson) Newsgroups: comp.sys.mac.programmer Subject: Re: Think C #include Question Message-ID: <1991Mar1.125815.5896@bootsie.uucp> Date: 1 Mar 91 12:58:15 GMT References: <1991Feb28.223430.24645@ux1.cso.uiuc.edu> Organization: Lexington Software Design, Lexington, MA Lines: 50 In article <1991Feb28.223430.24645@ux1.cso.uiuc.edu> dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) writes: > >-----------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 Leave this #include out > >struct Bar : Baz >{ > Foo *myFoo; /* an object of the Foo class */ change this to: struct Foo *myFoo; > . > . >}; >--------------------------- This works equivalently, but does not require the Foo.h header file. For another example, see CPanorama, which needs to use CScrollPane, which already #included CPanorama. -Eric -- Eric K. Olson, Editor, Prepare() NOTE: olson@bootsie.uucp doesn't work Lexington Software Design Internet: olson@endor.harvard.edu 72A Lowell St., Lexington, MA 02173 Uucp: harvard!endor!olson (617) 863-9624 Bitnet: OLSON@HARVARD