🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++
Article #98

initialization question

#98
From: Chris Thewalt
Date: Thu, 31 Aug 1989 15:22
12 lines
851 bytes
if I have a class X, and a constructor X(X&) defined, and abc is an
instance of X,then
  X a = abc
works as described in the book.
However, if I have abc and def as instances of X, and operator + defined
as: X& operator+(X&, X&), then the following:
  X a = abc + def
does not call the constructor when creating a (I get bitwise copy of result).
Is this behavior correct?
[note: using GNU g++ version 1.35]

thewalt@ce.cmu.edu
Technical Details
Message-ID: <QYzIoRy00iQJM8JkZb@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!hellgate.utah.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!ct13+

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!hellgate.utah.edu!cs.utexas.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!ct13+
From: ct13+@andrew.cmu.edu (Chris Thewalt)
Newsgroups: gnu.g++,comp.lang.c++
Subject: initialization question
Message-ID: <QYzIoRy00iQJM8JkZb@andrew.cmu.edu>
Date: 31 Aug 89 15:22:05 GMT
Organization: Civil Engineering, Carnegie Mellon, Pittsburgh, PA
Lines: 12