Date: Mon, 3 Feb 1997 11:24:42 +0100 (MET) From: Miguel Murillo To: Jean-Gaël GRICOURT cc: djgpp AT delorie DOT com Subject: Re: Pb with private members ... In-Reply-To: <32F39147.6896@snet.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 1 Feb 1997, Jean-Ga=EBl GRICOURT wrote: > Please tell me what do you think about this code ? >=20 > ------------------------------ >=20 > #include >=20 > class Object > { > private: > int data; > public: =20 > Object(int=3D0); > Object(Object&); > ShowData(); > }; >=20 > Object::Object(int d) > { data=3Dd; } >=20 > Object::Object(Object &o) > { data=3Do.data; } >=20 > Object::ShowData() > { return data; } >=20 >=20 > main() > { > Object InstObject1(5),InstObject2; >=20 > InstObject2=3DInstObject1; > cout< return 0; > } >=20 > ----------------------------------- >=20 > In the constructor "Object(Object &o)", the member "o.data" is accessed > although it is a private member ! > Is there something wrong ? >=20 > I used DJGPP 2.01 and I had no pb to compile this and it worked fine. >=20 The program is fine !!=20 I don't problem=20 =09=09=09=09=09=09Miguel