Easy learning with example program codes

CPP this Pointer

In CPP library, this is a pre-defined keyword which is used to refer to the current instance of a class.

Usage of CPP this Pointer:

  • to pass current object as a parameter to another method.
  • to refer current class instance variable.
  • to declare indexers.


#include <iostream.h>
using namespace std;
class Student
string Name;  
float ID;
Student(string Name, float ID) 	 
this-> Name = Name;    
this-> ID = ID;   
void details()
cout << "Student Name : " << Name << endl;
cout << "Student ID: " << ID << "\n\n";
int main()
Student s1 = Student("Khush", 1);    
Student s2 = Student("Raam", 2);  
return 0;


Student Name : Khush                
Student ID: 1   
Student Name : Raam 
Student ID: 2
Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki