开发者

In C++, why isn't the this keyword a reference? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

W开发者_JAVA技巧hy ‘this’ is a pointer and not a reference?

Is there a good reason that this is a pointer instead of a reference in C++?


The this concept was introduced before the reference concept was. At the time, this had to be a pointer.Source


From Stroustrup's FAQ

http://www2.research.att.com/~bs/bs_faq2.html#this


As crazy as it sounds it is actually legal to delete this;. Sometimes it is even warranted, but very rarely.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜