#include<iostream>
using namespace std;
class Time{
public:
Time(int,int,int);
int hour;
int minute;
int sec;
void get_time();
};
Time::Time(int h,int m,int s)//定义带参数的构造函数
{
hour=h;
minute=m;
sec=s;
}
void Time::get_time()
{
cout<<hour<<":"<<minute<<":"<<sec<<endl;
}
int main()
{
Time t1(10,13,56);
int *p1=&t1.hour ;//指向对象数据成员的指针
cout<<*p1<<endl;
t1.get_time();
Time *p2=&t1;//指向对象的指针
p2->get_time();
void (Time:: *p3)();//指向对象成员函数的指针
p3=&Time::get_time;
(t1.*p3)();
return 0;
}