*this vs this in C++

后端 未结 3 1099
逝去的感伤
逝去的感伤 2020-12-12 11:26

I understand what this does, but what is the difference between *this and this?

Yes, I have Googled and read over *this<

3条回答
  •  遥遥无期
    2020-12-12 11:42

    this is a pointer to the instance of the class. *this is a reference to the same. They are different in the same way that int* i_ptr and int& i_ref are different.

提交回复
热议问题