What is the advantage of having this/self pointer mandatory explicit?

后端 未结 6 1207
死守一世寂寞
死守一世寂寞 2020-12-08 16:04

What is the advantage of having this/self/me pointer mandatory explicit?

According to OOP theory a method is supposed to operate mainly (only?) on m

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 16:16

    You need it to pass the pointer/reference to the current object elsewhere or to protect against self-assignment in an assignment operator.

提交回复
热议问题