From: md2828 AT mclink DOT it (Marco Salvalaggio) To: r DOT humphris AT indigo-avs DOT com Cc: djgpp AT delorie DOT com Subject: Re: HELP - need help resolving conundrum with classes Date: Fri, 07 Mar 1997 22:31:44 GMT Message-ID: <3323973a.7457205@newmail.mclink.it> References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable On Thu, 6 Mar 1997 15:33:20 -0000, you wrote: >Sorry, but you are wrong, the code example shows you declaring an >instance of the owner class, a prototype >is done before the class is defined or instanciated, you will more often >than not have such prototypes in=20 >header files so that other classes can use their type, and compile >modularly. > >Rob Humphris > The example can't work 'cos the compiler doesn't have a chance of determining the actual class size (I mean the first declared one, the_cat) , the forward declaration doesn't carry enough information for this.=20 The only way to get the program work is to forward declare the_owner and then use a pointer (or a reference) to the_cat, this way: class the_owner; class the_cat { the_owner *its_owners; // other stuff .... }; class the_owner { the_cat cats_owned[5]; // other stuff .... }; Marco