#include <iostream>
using namespace std;
class Time
{
public:
Time(int h, int m, int s)
:hour(h), min(m), sec(s)
{
}
void display()
{
cout<<"this = "<<this<<endl;
cout<<hour<<min<<sec<<endl;
}
private:
int hour;
int min;
int sec;
};
int main()
{
Time t(1, 2, 3), t1(2, 3, 4), t2(3, 4, 5);
cout<<sizeof(Time)<<"***"<<sizeof(t)<<endl;//运行结果为12,说明不包括函数大小
cout<<"&t "<<&t<<endl;//在对象调用该函数的同时,向该函数传递了该对象的指针,该指针就是this
t.display();
cout<<"&t1 "<<&t1<<endl;
t1.display();
cout<<"&t2 "<<&t2<<endl;
t2.display();
return 0;
}