Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!think.com!huxley!glenn From: glenn@huxley.huxley.bitstream.com (Glenn P. Parker) Newsgroups: comp.lang.c++ Subject: Re: mutual dependence of types Message-ID: Date: 11 Jan 91 14:44:19 GMT References: <35527@netnews.upenn.edu> Sender: glenn@huxley.UUCP Reply-To: (Glenn Parker) Distribution: usa Organization: Bitstream, Inc. Lines: 27 In-reply-to: atteson@eniac.seas.upenn.edu's message of 11 Jan 91 01:43:37 GMT In article <35527@netnews.upenn.edu> atteson@eniac.seas.upenn.edu (Kevin Atteson ) writes: > Is there any way to do the following in C++ and if so how? > > [example of mutual class definition dependency elided] Because of the mutual dependency in the definitions of classes A and B, you can't *define* the functions func1 and func2 within their respective class definitions. They can still be inline, if that's important. Just move the function definitions after both of the necessary classes are defined. class A { public: class B func1(); }; class B { public: class A func2(); }; inline B A::func1() { ... } inline A B::func2() { ... } -- Glenn P. Parker glenn@bitstream.com Bitstream, Inc. uunet!huxley!glenn 215 First Street BIX: parker Cambridge, MA 02142-1270