钟表类
#include<iostream>
using namespace std;
class clock
{
public:
clock(int h,int m,int s);
clock();
void settime(int h,int m,int s);
void showtime();
private:
int hour,minute,second;
};
clock::clock(int h,int m,int s):hour(h),minute(m),second(s){}
clock::clock():hour(1),minute(0),second(0){}
//void clock::settime(int h,int m,int s)
//{
//hour=h;
// minute=m;
//second=s;
//}
inline void clock::showtime()
{
cout<<hour<<":"<<minute<<":"<<second<<endl;
}
int main()
{
clock c(8,8,8);
//c.showtime();
// c.settime(8,30,30);
// c.settime();
c.showtime();
return 0;
}