1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
class Test { public: int myint; public: Test() { myint = 0; }; void test() { printf("%d\n", myint); int myint = 1; printf("%d\n", myint); }; }; int main() { Test* t = new Test(); if (NULL != t) { t->test(); delete t; } }
1 2
0 1