//Program to acess data members of class using ‘this’ pointer

| |


#include<iostream.h>
#include<conio.h>
class rectangle
 { private:
 int l,b;
 public:
 void setdata(int i,int j)
 {
 cout<<"Address of object that generates the setdata()Call= "<<this<<"\n";
 this->l=i;
 this->b=j;
 }
 void area()
 {
 cout<<"Address of object that generates area()call= "<<this<<"\n";
 }
 };
 int main()
 { clrscr();
 rectangle r1;
 r1.setdata(10,15);
 r1.area();
 getch();
 return 0;
 }
<