home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!ukma!darwin.sura.net!sgiblab!ampex!leepeng
- From: leepeng@ampex.com (Peng Lee)
- Subject: Re: Multiple Header Files Problem
- Message-ID: <1992Nov6.172422.2563@ampex.com>
- Sender: usenet@ampex.com (News Poster)
- Nntp-Posting-Host: dd2-s4-12
- Organization: Ampex Corporation, Redwood City CA
- References: <1992Nov3.113121.3388@ntuix.ntu.ac.sg> <BxAA12.2Cz@well.sf.ca.us>
- Date: Fri, 6 Nov 1992 17:24:22 GMT
- Lines: 29
-
- In article <BxAA12.2Cz@well.sf.ca.us> donovan@well.sf.ca.us (Sean Donovan) writes:
- >In article <1992Nov3.113121.3388@ntuix.ntu.ac.sg> gthkoh@ntuix.ntu.ac.sg (Koh Thong Hwee) writes:
- >
- >> [define class B which references class A which references class B]
- >
- >In C++ you can specify a forward reference to a class by just saying:
- >
- >class <class-name>;
- >
- >In that header module you can then declare a member variable to that class.
- >
- >Ex:
- >
- >class A;
- >
- >class B {
- >private:
- > class A *foo;
- >};
- >
- >then go on to define your cyclic relation:
- >
- >class A {
- >private:
- > class B *bar;
- >};
-
- I wonder if this is how god solve the Chicken and Egg problem when
- (s)he created the world :-).
-