0
C++ program to show the use of this pointer?
2 Answers
0
class abc {
private:
int a;
int b;
public:
abc(int a, int b) {
this->a = a;
this->b = b;
}
};
not the best example, but all I can think of at the moment.
0
this pointer always points to the current object from where you are invoking it. It is also known as self reference. To understand above given example you need to first understand about pointers in c++, structure in C++ and some sample c/c++ programs using pointers.
http://www.techcrashcourse.com/2015/08/c-programming-pointers.html
http://www.techcrashcourse.com/2016/12/cpp-programming-access-structure-member.html