一样的问题啊
就是那几个函数你没有写具体的实现代码
#include
using namespace std;
class Point
{
public:
Point()
{
x=y=0;
}
Point(int,int);
~Point()
{
cout<<"finished"<
Point(Point &p)
{
x=p.x;
y=p.y;
}
Point operator +(Point &p2);
Point operator -(Point &p2);
void display();
private:
int x;
int y;
};
Point::Point(int a,int b):x(a),y(b)
{}
Point Point::operator +(Point &p2)
{
Point p;
p.x=x+p2.x;
p.y=y+p2.y;
return p;
}
Point Point::operator -(Point &p2)
{
Point p;
p.x=x-p2.x;
p.y=y-p2.y;
return p;
}
ostream&operator<<(ostream&,Point&);
void Point::display()
{
cout<<"("<
int main()
{
Point p1(3,4),p2(5,-10),p3;
p3=p1+p2;
cout<<"p1=";p1.display();
cout<<"p2=";p2.display();
cout<<"p1+p2=";p3.display();
return 0;
}