#include<iostream>
using namespace std;
class Point{
public:
Point(){
x=0;
y=0;
}
Point(float x1,float y1){
x=x1;
y=y1;
}
friend Point operator+(const Point &p1,const Point &p2);
Point& operator=(const Point &pd);
friend ostream & operator<<(ostream &out,const Point &p);
~Point(){}
private:
float x;
float y;
};
Point operator+(const Point& p1,const Point& p2){
Point p3;
p3.x=p1.x+p2.x;
p3.y=p1.y+p2.y;
return p3;
}
Point & Point::operator=(const Point &pd){
x=pd.x;
y=pd.y;
return *this;
}
ostream & operator<<(ostream &out,const Point &p){
out<<"("<<p.x<<","<<p.y<<")";
return out;
}
int main()
{
Point p1(2,3);
Point p2(5,6);
Point p3(4,5);
Point p4(5,2);
Point p5;
cout<<"p1初始坐标:"<<p1<<endl<<endl;
cout<<"p2初始坐标:"<<p2<<endl<<endl;
cout<<"p3初始坐标:"<<p3<<endl<<endl;
cout<<"p4初始坐标:"<<p4<<endl<<endl;
p5=p1+p2;
cout<<endl<<"p1+p2="<<p5;
p5=p3+p4;
cout<<endl<<"p3+p4="<<p5;
return 0;
}