diff --git a/ex4.1/Telephone.hh b/ex4.1/Telephone.hh index 371d826..e2d3da0 100644 --- a/ex4.1/Telephone.hh +++ b/ex4.1/Telephone.hh @@ -9,9 +9,21 @@ class Telephone { public: - Telephone() { std::cout << "Telephone Constructor " << this << std::endl ; } - Telephone(const Telephone& t ) { std::cout << "Telephone Copy Constructor " << this << std::endl ; } - ~Telephone() { std::cout << "Telephone Destructor " << this << std::endl ; } + Telephone() { + std::cout << "Telephone Constructor " << this << std::endl; + } + Telephone(const Telephone& t ) { + std::cout << "Telephone Copy Constructor " << this << std::endl; + + // Copy the data members + Cable cable = t.cable; + Housing housing = t.housing; + Dialer dialer = t.dialer; + Handset handset = t.handset; + } + ~Telephone() { + std::cout << "Telephone Destructor " << this << std::endl; + } private: diff --git a/ex4.1/main.cpp b/ex4.1/main.cpp index 1d527dc..263bc75 100644 --- a/ex4.1/main.cpp +++ b/ex4.1/main.cpp @@ -3,5 +3,9 @@ int main(){ Telephone t; + std::cout << std::endl; + std::cout << "Cloning the Telephone object" << std::endl; + std::cout << std::endl; + Telephone t2 = t; }