Use of this operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Use of this operator

this

1st Aug 2017, 5:31 PM
SHUBHAM P
SHUBHAM P - avatar
6 Answers
+ 1
this keyword is used to access current class members. the program shows how this and super works. hope it helps. https://code.sololearn.com/cDoKCF1uyaI6/?ref=app
1st Aug 2017, 8:38 PM
Devbrath
Devbrath - avatar
+ 3
What is your question exactly?
1st Aug 2017, 5:37 PM
winfrjd
winfrjd - avatar
+ 2
class A { private: int a; public: A (int a){ // the object's variable is now equal to the paramater given this->a=a; } };
1st Aug 2017, 6:17 PM
Andrés04_ve
Andrés04_ve - avatar
+ 1
this refers to as in this class. example you made a variable called $hi in user class. this->$hi. thats in php
1st Aug 2017, 5:38 PM
DEVIL
DEVIL - avatar
+ 1
points to the current class. you dont use this out side of a class
1st Aug 2017, 5:39 PM
DEVIL
DEVIL - avatar
0
Is this pointer a object .....that is used to point the other object ?
1st Aug 2017, 5:38 PM
SHUBHAM P
SHUBHAM P - avatar