可能顯示的文件類型:
Why ‘this’ is a pointer and not a reference?
SAFE Pointer to a pointer (well reference to a reference) in C#爲什麼 '這個' 關鍵字不是引用在C++
在C++中的this
關鍵字都有一個指針指向該對象我目前上午。
我的問題是爲什麼this
類型的指針類型而不是引用類型。 有沒有什麼條件下this
關鍵字是NULL
?
我的直接想法是在一個靜態函數中,但Visual C++至少足夠聰明地發現它並報告static member functions do not have 'this' pointers
。這是在標準?
Dupe http://stackoverflow.com/questions/645994/why-this-is-a-pointer-and-not-a-reference – 2010-02-11 18:30:04
不完全重複!另一個問題沒有解決這裏提出的次要問題,比如「可以'這個'永遠是空的嗎?」。當這個問題結束時,我正在回答這個問題。 – 2010-02-11 18:58:22
是「有什麼條件下''this''關鍵字將* NULL *?」在別處回答? – 2010-02-11 19:59:10