| www.delorie.com/archives/browse.cgi | search |
| From: | Andy Maddison <maddison AT coventry DOT ac DOT uk> |
| 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: | <Pine.OSF.3.91.980216121910.29538D-100000@leofric> |
| References: | <6c99k6$1u6 AT bgtnsc02 DOT worldnet DOT att DOT net> |
| NNTP-Posting-Host: | leofric.coventry.ac.uk |
| Mime-Version: | 1.0 |
| 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 |
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
};
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |