重载问题
#include <iostream>
using namespace std;
class Operclass
{
int x;
public:
Operclass();
Operclass operator++();
Operclass operator++(int);
void display();
}
void Operclass::Operclass()
{
x=0;
}
void Operclass::display()
{
cout<<"x="<<x<<endl;
}
Operclass Operclass::operator++()
{
Operclass A;
x++;
A.x=x;
return A;
}
Operclass Operclass::operator++(int)
{
Operclass A;
x++;
A.x=x;
return A;
}
void main()
{
Operclass X,Y;
X.display();
++X;
Y=++X;
}
那里错了啊