Mail Archives: djgpp/1997/02/03/06:58:04
Jean-Gaël GRICOURT wrote:
>
> Please tell me what do you think about this code ?
>
> ------------------------------
>
> #include <iostream.h>
>
> 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 *
*****************************************************************
- Raw text -