From: Robert Hoehne Newsgroups: comp.os.msdos.djgpp Subject: Re: Pb with private members ... Date: Mon, 03 Feb 1997 11:47:55 +0100 Organization: TU Chemnitz-Zwickau Lines: 35 Message-ID: <32F5C25B.698F@Mathematik.tu-chemnitz.de> References: <32F39147 DOT 6896 AT snet DOT net> NNTP-Posting-Host: cancel.hrz.tu-chemnitz.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Jean-Gaël GRICOURT wrote: > > Please tell me what do you think about this code ? > > ------------------------------ > > #include > > class Object > { > private: > int data; > public: > Object(int=0); > Object(Object&); > ShowData(); If you compile with '-Wall' you will get a warning here. Better: int ShowData(); > Object::Object(Object &o) > { data=o.data; } This is correct, since the class Object is allowed to access its own private members even from an other variable. Robert -- ***************************************************************** * Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau * * Post: Am Berg 3, D-09573 Dittmannsdorf * * e-Mail: Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE * * WWW: http://www.tu-chemnitz.de/~rho * *****************************************************************