C++ simple program of This Pointer

      No Comments on C++ simple program of This Pointer
#include<iostream.h>
#include<conio.h>
class scan
{
int i;
public:
void setdata(int i)
 {
  this->i=i;
 }
void display()
{
 cout<<"Object address is:- "<<this<<endl;
 cout<<"Value of i is :- "<<i;
}
};
void main()
{
clrscr();
scan s1;
s1.setdata(23);
s1.display();
getch();
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *