可能显示的文件类型:
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