网站介绍:文章浏览阅读4.4w次,点赞68次,收藏187次。别跟我说, return *this返回当前对象, return this返回当前对象的地址(指向当前对象的指针)。 正确答案为:return *this返回的是当前对象的克隆或者本身(若返回类型为A, 则是克隆, 若返回类型为A&, 则是本身 )。return this返回当前对象的地址(指向当前对象的指针), 下面我们来看看程序吧:#include using namespace std;class A{public: int x; A_return*this
- 链接地址:https://blog.csdn.net/stpeace/article/details/22220777
- 链接标题:今天看到的一个有趣面试题:return *this和return this有什么区别?_return*this-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:2765
- 网站标签:return*this