CS202 6- ‹#›
Copy Constructors
nTo resolve the pass by value and the initialization issues, we must write a copy constructor whenever dynamic member is allocated on an object-by-object basis.
nThey have the form:
n
nclass_name(const class_name &class_object);
n
nNotice the name of the “function” is the same name as the class, and has no return type
nThe argument’s data type is that of the class, passed as a constant reference (think about what would happen if this was passed by value?!)