单项选择题

已知有以下程序
class Point{  
    private:
        float x,y; //点的坐标
    public:
        Point(float h,float v);
};
class Line
{
    private:
        Point  p1,p2;
    ……
};
则哪些Line类的构造函数定义是正确的(     ) A.
Line(){}    B.
Line(Point xp1, Point xp2):p1(xp1),p2(xp2) 
{ }  C.
Line(Point xp1, Point xp2)
{
  p1 = xp1;
  p2 = xp2;
}
D.
Line(double xp1, double yp1, double xp2, double yp2)
{
  p1.x = xp1;
  p1.y =yp1;
  p2.x = xp2;
  p2.y = yp2;
 }

热门 试题