classPerson{public:voidshowClass(){
cout <<"class Name is Person"<< endl;}voidshowAge(){//防止空指针访问成员变量,空指针不没有成员变量,调用会出错if(this==NULL){return;}
cout <<"age = "<<this->m_Age << endl;}int m_Age;};voidtest01(){//空指针
Person * p =NULL;//未使用this指针可以正常调用
p->showClass();
p->showAge();}