I don't understand the 'this' function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

I don't understand the 'this' function?

Will anyone help me?

13th Jun 2016, 5:07 PM
Utpal Kumar
Utpal Kumar - avatar
6 Answers
+ 10
it refers to the object itself. because sometimes you dont know for example what was clicked so you can use only one method for many objects with different names or id
13th Jun 2016, 6:19 PM
Klodian Lula
Klodian Lula - avatar
+ 6
We can call it compiler pointer and it point on current active object
14th Jun 2016, 8:51 AM
Aso Harutyunyan
Aso Harutyunyan - avatar
+ 2
Thanks!
13th Jun 2016, 6:31 PM
Utpal Kumar
Utpal Kumar - avatar
+ 2
very helpful answers. thanks guys! is self used in c++ too or is it just this?
30th Jun 2016, 12:13 PM
Zak Person
Zak Person - avatar
0
The this pointer is basically an implicit argument when calling a non-static method. It simplifies the synthax.
7th Nov 2016, 3:08 AM
Amit
0
It is also used for calling an object local variables. For example: https://code.sololearn.com/clhLD96GS0AP/?ref=app
3rd Mar 2018, 12:30 AM
Miroslav M
Miroslav M - avatar