#include
using namespace std;
template<typename T>
struct Point{
int x,y;
Point(T x=0,T y=0):x(x),y(y){}
};
template<typename T>
Point operator +(const Point &A,const Point &B){
return Point (A.x+B.x,A.y+B.y);
}
template<typename T>
ostream &operator<<(ostream &out,const Point &p){
out<<"("<","<")";
return out;
}
int main(){
Point<double>d(1.1,2.2),e(3.3,4.4);
cout<return 0;
}
因为Point里的x和y是int类型啊
应该改成 T x,y;