From: Andy Maddison Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with class "chicken or the egg" problem Date: Mon, 16 Feb 1998 12:24:23 +0000 Organization: Coventry University Message-ID: References: <6c99k6$1u6 AT bgtnsc02 DOT worldnet DOT att DOT net> NNTP-Posting-Host: leofric.coventry.ac.uk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <6c99k6$1u6@bgtnsc02.worldnet.att.net> Lines: 36 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Mon, 16 Feb 1998, Riley wrote: > I am having trouble writing a program. Is there an equivalent to a function > prototype but for classes??? I have two classes that have pointers to each > other and I can't figure out how to define them. Attached is a simple > demonstration program to get my point across. > > Thanks, > > Riley > hitzl AT usa DOT net I think you just need to declare one class name like so: class B; then define them: class A; { private: B* ptrToB; public: A(); //constructor }; class B; { private: A* ptrToA; public: B(); //constructor };