#include <iostream>
using namespace std;
class Unary
{
int a, b, c;
public:
Unary()
{
a = b = c = 0;
}
Unary(int i, int j, int k)
{
a = i;
b = j;
c = k;
}
void operator ++ ();
void Display();
};
void Unary::operator++()
{
++a;
++b;
++c;
}
void Unary::Display()
{
cout << a << ", ";
cout << b << ", ";
cout << c << "\n";
}
int main()
{
Unary a (12, 22, 33);
a.Display();
++a;
a.Display();
return 0;
}
Note: Need to be arranged in compiler after copied
OutPut:
12, 22, 33
13, 23, 34
13, 23, 34