this Pointer in C++1 min read

In C++, this is a keyword that refers to the current instance of a class and this pointer holds the address or points to the current object of the class. Also, only the member functions have this pointer.

Members like friend functions do not have this pointer as they are not members of the class.

Example of this pointer in C++

Let us see an example of C++ this pointer that refers to the fields of the current class.

Output:

Roll No: 1101
Name: John
Score: 80


Roll No: 1102
Name: Emma
Score: 95


MORE

C Program to Convert Decimal to Binary

In this tutorial, we will write a C program to convert decimal to binary. Before that, you must have knowledge of the following topics in …
Read More

C Program to Convert Binary to Decimal

In this tutorial, we will write a program to convert binary to decimal in C. Before that, you must have knowledge of the following topics …
Read More

C Program to Print ASCII Value of a Character

In this tutorial, we will write a program to print ASCII value of a character in C programming. Before that, you should have knowledge on …
Read More

Java Program to Convert Binary to Hexadecimal

In this tutorial, we will write a Java Program to Convert a Binary Number to Hexadecimal Number. Before that, you must have knowledge of the …
Read More

Java Program to Convert Hexadecimal to Binary

In this tutorial, we will write a Java Program to Convert a Hexadecimal Number to Binary Number. Before that, you must have knowledge of the …
Read More

Java Program to Convert Hexadecimal to Decimal

This is a Java Program to Convert a Hexadecimal Number to its decimal Equivalent. Before that, you must have knowledge of the following topics in …
Read More