對象指針爲NULL,爲什麼還是可以調用成員函數

B 要理解這個的話。。。成員函數其實可以認爲是一個普通的函數,比如 1 2 3 4 class A{ public:     void func(int x) { cout<<"hello, A. x="<<x<<endl; } }; 在編譯器看來,大概就長這個樣子吧: 1 void A_func(A* this, int x) { cout<<"hello, A. x="<<x<<endl; }
相關文章
相關標籤/搜索