PROGRAM TO SHOW THE CONCEPT OF THIS POINTER

/*PROGRAM TO SHOW THE CONCEPT OF THIS POINTER*/

#include<conio.h>

#include<iostream.h>

class temp

{

int a;

public:

void process()

{

cout<<“Enter the value: “;

cin>>a;

cout<<“Value of is: “<<a<<endl;

}

void show_adrs()

{

cout<<“Address of object is: “<<this<<endl;

}

};

void main()

{

temp t1,t2;

clrscr();

cout<<“First object data”<<endl;

t1.process();

t1.show_adrs();

cout<<“Second object data”<<endl;

t2.process();

t2.show_adrs();

getch();

}

Leave a Reply

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