C++ Programming: Bitwise Copy

A default copy constructor does not do a Bitwise Copy under the following circumstances


  • When the class contains a member object of a class for which a copy assignment operator exists


  • When the class is derived from a base class for which a copy assignment operator exists

  • When the class declares one or more virtual functions (we must not copy the vptr address of the right-hand class object, since it might be a derived class object)


  • When the class inherits from a virtual base class (this is independent of whether a copy operator exists for the base class)



Labels:


About this entry