// This program demonstrates the operation of the default copy constructor. #include using namespace std; class Address { private: string street; public: Address() //constructor { street = ""; } Address(string st) //constructor { setStreet(st); } void setStreet(string st) { street = st; } string getStreet() { return street; } }; int main() { // Mary and Joan live at same address. Address mary("123 Main St"); //invokes constructor Address joan = mary; //invokes the dafault copy constructor cout << "Mary lives at " << mary.getStreet() << endl; cout << "Joan lives at " << joan.getStreet() << endl << endl; // Now Joan moves out. joan.setStreet("1600 Pennsylvania Ave"); cout << "Now Mary lives at " << mary.getStreet() << endl; cout << "Now Joan lives at " << joan.getStreet() << endl; return 0; }