题 号: 154 完成NewClock类(C++) 语言要求: C++
引入头文件Clock.h
,它的内容如下:
#include <iostream>
using namespace std;
class Clock{
public:
Clock(int h,int m,int s){
hour =(h>23? 0:h);
minute = (m>59?0:m);
second = (s>59?0:m);
}
virtual void run(){
second = second+1;
if (second>59)
{
second =0;
minute+=1;
}