#include <iostream>
using namespace std;
class Time
{
public://定义公用的数据或成员函数
void set_time();
void show_time();
private://定义私有的数据或成员函数
int hour;
int minute;
int sec;
};
Time t;
int main()
{
t.set_time();
t.show_time();//对象之中的函数
return 0;
}
void Time::set_time()//函数类型为空类型 作用域运算符
{
cin >> t.hour;
cin >> t.minute;
cin >> t.sec;
}
void Time::show_time()//函数类型为空类型 作用域运算符
{
cout << t.hour << ":" << t.minute << ":" << t.sec << endl;
}