www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/03/06:58:04

From: Robert Hoehne <Robert DOT Hoehne AT Mathematik DOT tu-chemnitz DOT de>
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
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 <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019