return *this和return this有什么区别?

return *this返回的是当前对象的克隆或者本身(若返回类型为A, 则是克隆, 若返回类型为A&, 则是本身 )。

return this返回当前对象的地址(指向当前对象的指针)。

 

转:https://blog.csdn.net/stpeace/article/details/22220777

posted on 2019-03-27 11:37  zkfopen  阅读(364)  评论(0编辑  收藏  举报

导航