0

C++ program to show the use of this pointer?

11th Feb 2017, 1:03 AM
Akash Mahajan
Akash Mahajan - avatar
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.
11th Feb 2017, 3:05 AM
Nikunj Arora
Nikunj Arora - avatar
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
14th Apr 2017, 12:14 PM
Arun Kumar
Arun Kumar - avatar