I'm not able to compile the below code, but i'm able to compile it under visual studio with another laptop, I don't no if there are a different configuration that shout be set.
#include<iostream>
using namespace std;
class Unary {
private:
int x, y;
public:
Unary(int i = 0, int j = 0) {
x = i;
y = j;
}
void show()
{
cout << x << " " << y << endl;
}
void operator++()
{
x++;
y++;
}
};
int main() {
Unary v(10, 20);
v++;
v.show();
}
and it's giving the below error :
Error C2676: binary '++': 'Unary' does not define this operator or a conversion to a type acceptable to the predefined operator