#include<iostream>
using namespace std;
class complex
{
double real;
double imag;
public:
complex operator++() //for postfix incriment copmplex operator++(int)
{
real++;
imag++;
complex temp;
temp.real=real;
temp.imag=imag;
return temp;
}
void display()
{
cout<<“(“<<real<<“,”<<imag<<“)”<<endl;
}
void set()
{
cout<<“Enter real: “<<endl;
cin>>real;
cout<<“Enter imag: “<<endl;
cin>>imag;
}
};
int main()
{
complex c1;
c1.set();
++c1; //for postfix incriment c1++;
c1.display();
system(” pause”);
}
<—-End—->
Output:
Enter real:
3
Enter imag:
4
( 4 , 5 )