#include<iostream>
#include<cmath>
using namespace std;
/*定义类*/
class time
{
public:
void SetTime(int newH = 0, int newM = 0, int newS = 0);
void ShowTime();
private:
int hour;
int minute;
int second;
};
//类方法的实现 方法名称相当于一个接口
void time::SetTime(int newH , int newM , int newS )
{
hour = newH;
minute = newM;
second = newS;
}
void time::ShowTime()
{
cout<<hour<<":"<<minute<<":"<<second;
}
int main(){
time mytime;//定义一个time类的对象 mytime
mytime.SetTime(20 , 47 ,50);
mytime.ShowTime();
return 0;
}