为什么这个指针在C中是一个指针而不是引用?
有没有使用我错过的使用“this”作为一个比引用更有用的指针?
如果不是,有没有任何语言设计的含义/考虑作为一个指针?
解决方法
从
Bjarne Stroustrup’s C++ Style and Technique FAQ:
@H_404_10@
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”.