#include<iostream.h>
class Clock
{public:
Clock(int NewH=2,int NewM=30,int NewS=39);
Clock (Clock &P);
void SetTime(int NewH,int NewM,int NewS);
void ShowTime();
private:
int Hour,Minute,Second;
};
void Clock::SetTime(int NewH,int NewM,int NewS)
{ Hour=NewH;
Minute=NewM;
Second=NewS;
}
Clock::Clock(int NewH,int NewM,int NewS)
{ Hour=NewH;
Minute=NewM;
Second=NewS;
}
inline void Clock :: ShowTime()
{ cout<<Hour<<":"<<Minute<<":"<<Second<<endl;
}
Clock::Clock(Clock &P)
{ Hour=P.Hour;
Minute=P.Minute;
Second=P.Second;
cout<<"拷贝构造函数调用"<<endl;
}
void fun1(Clock thisClock)
{ thisClock.ShowTime;
}
Clock fun2()
{Clock aa(1,2,3);
return aa;
}
void main()
{ Clock myclock;
Clock cc(1,2,3);
Clock yourclock(myclock);
Clock dd;
cout<<"Please settime first"<<endl;
myclock.SetTime(0,0,0);
myclock.ShowTime();
cout<<"the appear two vido"<<endl;
myclock.SetTime(8,30,52);
myclock.ShowTime();
cout<<"please three appear"<<endl;
cc.ShowTime();
cout<<"please four appear"<<endl;
yourclock.ShowTime();
fun1(yourclock);
dd=fun2();
dd.ShowTime;
}