Previous      Up      Previous     Course Home   e-mail

2.6 Shallow & Deep Copying

If We Never Write Our Own   

If our data members do not have explicit copy constructors (and their data members do not have explicit copy constructors, and …) then the compiler-provided copy constructor amounts to a bit-by-bit copy.

Shallow vs Deep Copy   

Copy operations are distinguished by how they treat pointers:


Shallow copy is wrong when...   


Compiler-generated copy constructors are wrong when...   


 Previous      Up      Previous     Course Home   e-mail