How to explain 'this' keyword in a best and simple way?

前端 未结 6 2199
别那么骄傲
别那么骄傲 2020-12-06 19:40

I am using \'this\' keyword for a long time. But when someone asks me to explain it, I am confused that how to explain it. I know that I can use this in a method of class to

6条回答
  •  庸人自扰
    2020-12-06 20:23

    this references the current object instance of a class.

    this is an implicitly parameter passed to the methods of a class: it is scoped to a method and allows access to all of the object's members.

提交回复
热议问题