class Point{public: Point(int newX=0,int newY=0){ x=newX; y=newY; } Point(Point &p){ x=p.x; y=p.y; } int getX() { return x; } int getY() { return y; }private: int x,y;};class Line{ public: Line(Point new_p1,Point new_p2):p1(new_p1),p2(new_p2){ double x=static_cast<double>(p1.getX()-p2.getX()); double y=static_cast<double>(p1.getY()-p2.getY()); len=sqrt(x*x+y*y); } private: Point p1,p2; double len; };这里Line类的第二行,Line(Point new_p1,Point new_p2),Point new-p1,这怎么理解啊?以前参数为int a,int b可以理解成整数类型的参数,Point是??
添加回答
举报
0/150
提交
取消