Describe pointer to object with an example.
When address of an object of a class is stored into the pointer variable of the same class type then it is pointer to object. This pointer can be used to access the data member and member functions of same class.
Following example illustrate use of pointer to object
#include<conio.h>
#include<iostream.h>
class product
{
private:
int code;
float price;
public:
void getdata(void)
{
cout<<"\n Enter code";
cin>>code;
cout<<"\n Enter price";
cin>>price;
}
void display(void)
{
cout<<"\n Code="<<code<<"\n Price="<<price;
}
};
void main()
{