#include <iostream.h>
#include<conio.h>
class myClass
{
int num;
public:
void set_num(int val)
{
num = val;
}
void show_num()
{
cout<< num << endl;
}
};
void main()
{
clrscr();
myClass ob[2], *objectPointer;
ob[0].set_num(10);
ob[1 ].set_num(20);
objectPointer = &ob[0];
objectPointer->show_num();
objectPointer++;
objectPointer->show_num();
objectPointer--;
objectPointer->show_num();
getch();
}
Output :
10
20
10