delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/24/10:05:57

Date: Fri, 24 May 2002 16:04:35 +0200 (MEST)
From: ahelm AT gmx DOT net
To: djgpp AT delorie DOT com
MIME-Version: 1.0
Subject: RE: GCC v3.1 problem with implicit copy constuctor
X-Priority: 3 (Normal)
X-Authenticated-Sender: #0003579562 AT gmx DOT net
X-Authenticated-IP: [194.201.128.5]
Message-ID: <22367.1022249075@www22.gmx.net>
X-Mailer: WWW-Mail 1.5 (Global Message Exchange)
X-Flags: 0001
Reply-To: djgpp AT delorie DOT com

I'm getting old.... 
(some incorrect xx and yy were used)
The code should be:

class QQ;

class RR
{ 
public:
  short xx;
        RR(const long long i);
        RR();
        RR(const RR& f);
        ~RR();
};

class QQ
{
public:
  RR    yy[4][4];
        QQ();
        QQ(const RR& f);
        ~QQ();
};

inline RR::RR(const long long i)
{
  xx = (short)i;
}

inline RR::RR() {xx = 0;}
inline RR::RR(const RR& f) {xx = f.xx;}
inline RR::~RR() {}

inline QQ::QQ()
{
  for(int i=0;i<4;i++)
  {
    for(int j=0;j<4;j++)
    {
      yy[i][j] = 0;
    }
  }
}

inline QQ::QQ(const RR &f)
{
  for(int i=0;i<4;i++)
  {
    for(int j=0;j<4;j++)
    {
      yy[i][j] = f;
    }
  }
}

inline QQ::~QQ(){}

int main()
{
  QQ x  = RR(123);
  QQ *y = &x;
  QQ z  = *y;

  return x.yy[3][3].xx;
}

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

- Raw text -


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