Home >>C++ Tutorial >C++ This Pointer
The current instance of the class is referred to by this keyword in C++ programming hence; this is known as the this Pointer in C++.
In terms of usage, there are these three main uses of this keyword in the C++ programming language that are mentioned below:
Here is an example of the this keyword in the C++ programming language referring to the fields of the current class:
#include <iostream> using namespace std; class Student { public: int roll_no; string name; float marks; Student(int x, string y, float z) { this->roll_no = x; this->name = y; this->marks = z; } void show() { cout<<"Student Name "<<roll_no<<endl; cout<<"Student Roll "<<name<<endl; cout<<"Student Marks "<<marks<<endl; } }; int main(void) { Student stu =Student(102, "Shishir",90); stu.show(); return 0; }