A great feature of C++ is that shallow copy constructors and assignment operators are done for you. If you have a class with simple types, you automatically get the ability to construct a clone of any existing object, or assign any one object to another.

However, if you have member variables that are involved in any kind of dynamic allocations, you’re going to need to override the default copy/assignment functions with your own “deep copy” versions.  (continued…)