A copy constructor initializes a new C++ object from an existing object of the same type. C++ invokes it automatically when objects are copied, including during vector operations, so seemingly simple code can perform hidden construction, destruction, allocation, and deallocation. The copy constructor, copy assignment operator, and destructor form the Big Three; explicitly implementing one generally calls for implementing all three. section 6.2.2
Copying Date objects
An instrumented Date class defines Date(const Date& other), prints a message, and copies year, month, and day member by member. Appending Date values to a vector, inserting them, returning them, and printing them exposes repeated copy-constructor calls. The output makes the performance cost of value-based interfaces visible. A vector of Date pointers avoids those object copies in the demonstrated program, but changes the interface and lifetime responsibilities.

