关于c ++:为什么这是一个指针


Why is this a pointer

本问题已经有最佳答案,请猛点这里访问。

Possible Duplicate:
Why 'this' is a pointer and not a reference?

为什么this是指针,而不是rhan引用?有可能是NULL吗?


Why is"this" not a reference?

请看比亚恩的回答。

Because"this" was introduced into C++ (really into C with Classes) before references were added. Also, I chose"this" to follow Simula usage, rather than the (later) Smalltalk use of"self".


Why is this a pointer?

< /块引用>

因为它是,而且它只是编程语言的设计方式。(我认为这也是因为它是C留下来的,但我不确定)。

rather than a reference?

< /块引用>

如果需要此引用,请使用*this

Can it never be NULL?

< /块引用>

…不,怎么可能?