The this pointer is an implicit, compiler generated pointer to the current object that a method is manipulating. It is used to differentiate scope between parameters and members, in the case where they have the same name. Example...
class myclass {
...
int data1;
...
mymethod(int data1) {
data1 = data1; /*ambiguous */
this->data1 = data1; /* not ambiguous */
}
...
secondmethod(int data2) {
data1 = data2; /* not ambiguous */
}
...
}
Many coders use some prefix, such as underscore, to mark member variables. This works, but is not necessary.
Copyright © 2026 eLLeNow.com All Rights Reserved.