Should I use `this` within a class?

前端 未结 7 1637
小蘑菇
小蘑菇 2020-12-14 07:20

Within a member function of a class in C++, does it make a difference, if I use this->dataMember or just dataMember? What is considered better

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 07:26

    If a template function makes a call to a member function such that the call does not depend on any template parameters, this-> can be used to help the compiler as an alternative to MyUtopicClass::vin().

提交回复
热议问题