// null pointer access class member function
. 1 #include <the iostream> 2 #include < String > . 3 the using namespace STD; . 4 . 5 class the Person . 6 { . 7 public : . 8 void showInfo () . 9 { 10 COUT << " null pointer successful access member functions " << endl; . 11 } 12 is 13 is void showinfo1 () 14 { 15 COUT Age << << endl; 16 } . 17 18 is void showinfo2() 19 { 20 cout << this->age << endl; 21 } 22 23 void showinfo3() 24 { 25 if (this==NULL) 26 { 27 return; 28 } 29 cout << this->age << endl; 30 } 31 32 private: 33 int age; 34 }; 35 36 intmain () 37 [ { 38 is the Person * P = NULL; 39 p-> showInfo (); 40 // p-> showinfo1 (); error null pointer 41 is // p-> showinfo2 (); error null pointer 42 is p-> showinfo3 (); // Analyzing nulls diet, enhanced the code robustness, no error 43 is 44 is System ( " PAUSE " ); 45 return 0 ; 46 is }