Talk:Copy constructor (C++)
Appearance
Why do we need to use & in the definition of a copy constructor? --Anonymous
This article has an error regarding the implicit copy constructor. It does not perform a "byte-by-byte" copy of its members, since its members could have user-defined copy constructors as well. The standard specifies:
The implicitly-defined copy constructor for class X performs a memberwise copy of its subobjects. The order of copying is the same as the order of initialization of bases and members in a user-defined constructor (see 12.6.2). Each subobject is copied in the manner appropriate to its type: — if the subobject is of class type, the copy constructor for the class is used; — if the subobject is an array, each element is copied, in the manner appropriate to the element type; — if the subobject is of scalar type, the built-in assignment operator is used. Virtual base class subobjects shall be copied only once by the implicitly-defined copy constructor (see 12.6.2).
I will correct this now.