#include<iostream>
using namespace std;
class Point
{
int x,y,z;
public:
Point(int a,int b,int c)
{a=x;b=y;c=z;}
~Point(){}
Point& operator ++();
Point operator ++(int);
friend ostream& operator <<(ostream& out,Point& p1);};
Point& Point ::operator ++()
{
x++;
y++;
z++;
return *this;
}
Point Point ::operator ++(int)
{
Point old = *this;
++ (*this);
return old;
}
ostream& operator <<(ostream& out,Point& p1)
{
out<<p1.x<<","<<p1.y<<","<<p1.z;
return out;
}
int main()
{
Point p1(10,20,30);
++p1;
cout<<p1<<endl;
p1++;
cout<<p1<<endl;
}
构造函数错误
Point(int a,int b,int c){x = a; y = b; z = c;}
谢谢了