1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| #include<iostream> using namespace std; class Person { public: int m_Age; void showClassName() { cout << "this is Person class" << endl; }
void showPersonAge1() { if (this == NULL) { return; } cout << "age = " << m_Age << endl; } void showPersonAge() { cout << "age = " << m_Age << endl; } }; void test02() { Person* p; p->showClassName(); p->showPersonAge1(); } int main() { test02(); return 0; }
|