The this Keyword

Get introduced to this keyword in this lesson.

We'll cover the following

For the sake of simplicity

For simplicity, it is a popular practice to give a parameter the same name as the member variable it is being assigned to. In such a case, the this keyword can be used to differentiate between the parameter and the member variable.

⚙️ Note: The this keyword refers to the class itself.

Put simply, the this keyword can be used in a class to refer to the current calling object.

Example

Look at the example below.

Get hands-on with 1400+ tech skills courses.