1 Answers
#include<iostream> class MyTime { int hh; int mm; public: MyTime(int x,int y):hh(x),mm(y) { } MyTime(const MyTime& ref):hh(ref.hh),mm(ref.mm){ } void display() { std::cout << hh << ":" << mm << "\n"; } }; int main() { MyTime t1(10,20); t1.display(); MyTime t2(t1); t2.display(); return 0; }