382 views

1 Answer

Best answer
1 votes
1 votes

The ‘this’ pointer is passed as a hidden argument to all nonstatic member function calls and is available as a local variable within the body of all nonstatic functions. ‘this’ pointer is a constant pointer that holds the memory address of the current object. ‘this’ pointer is not available in static member functions as static member functions can be called without any object (with class name).
For a class X, the type of this pointer is ‘X* const’. Also, if a member function of X is declared as const, then the type of this pointer is ‘const X *const’

http://www.geeksforgeeks.org/this-pointer-in-c/

selected by

Related questions

0 votes
0 votes
3 answers
3
lalitver10 asked Oct 23, 2021
708 views
#include <stdio.h>int main(){ int a=20; int *ptr=&a; int x=a; printf ("%p\n",&*ptr); printf ("%p\n",&a); return 0;}Why both printf() line printing the s...
4 votes
4 votes
1 answer
4
admin asked Mar 31, 2020
2,118 views
Prior to using a pointer variable it should bedeclared.initialized.both declared and initialized.none of these.