我什么時(shí)候應(yīng)該明確使用‘this’指針?我什么時(shí)候應(yīng)該顯式地寫(xiě)this->member一門(mén)課的方法?
3 回答

犯罪嫌疑人X
TA貢獻(xiàn)2080條經(jīng)驗(yàn) 獲得超4個(gè)贊
#include <iostream>using namespace std;class A{ public: int a; void f() { a = 4; int a = 5; cout << a << endl; cout << this->a << endl; }};int main(){ A a; a.f();}
5
4
- 3 回答
- 0 關(guān)注
- 756 瀏覽
添加回答
舉報(bào)
0/150
提交
取消