/*PROGRAM TO OVERLOAD PRE INCREMENT, POST INCREMENT, PRE DECREMENT AND POST DECREMENT OPERATORS*/
#include<conio.h>
#include<iostream.h>
class overlod
{
int a;
public:
void input()
{
cout<<“Enter a: “;
cin>>a;
}
void operator ++()
{
a=a+1;
}
void operator ++(int)
{
a=a+1;
}
void operator –()
{
a=a-1;
}
void operator –(int)
{
a=a-1;
}
void display()
{
cout<<“Value of a is: “<<a<<endl;
}
};
void main()
{
overlod a1;
clrscr();
a1.input();
a1.display();
cout<<“After pre increment “;
++a1; //PREINCREMENT
a1.display();
cout<<“After post increment “;
a1++;
a1.display();
cout<<“After pre decrement “;
–a1;
a1.display();
cout<<“After post decrement “;
a1–;
a1.display();
getch();
}