Is there any overhead using this-> for accessing a member?

前端 未结 5 1047
死守一世寂寞
死守一世寂寞 2021-01-11 17:33

When accessing a member of some class, I can use e.g.:

this->myVar = 10 

or I can just write:

myVar = 10
5条回答
  •  生来不讨喜
    2021-01-11 18:07

    Those two lines of code have the same meaning. The this-> is implicit in the second line. They do exactly the same thing.

    Thus, they perform exactly the same as well :-)

提交回复
热议问题