C++有关指针练习

#include
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<}

int main()
{Time t1(10,36,5);
int p = &t1.hour;
cout<<
p <t1.get_time();
Time p2 = &t1;
p2-> get_time();
void(Time::
p3)();
p3 = &Time::get_time;
(t1.*p3)();
return 0;
}

转载于:https://blog.51cto.com/13615683/2096686

你可能感兴趣的:(C++有关指针练习)