组合类的设计,编译器一直报错,就是没有告诉小弟我错在哪行

组合类的设计,编译器一直报错,就是没有告诉我错在哪行?
  设计一个line(线段类),子类有Piont类。
#include<iostream>
#include<cmath>
using namespace std;
class Point{
private:
int x,y;
public:
Point()
{
x=0;
y=0;
}
Point(int x,int y)
{
this->x=x;
this->y=y;
}
Point(Point &p)
{
x=p.x;
y=p.y;
}

int GetX();
int GetY();
void SetX();
void SetY();
};

class Line{
private:
Point p1,p2;
float len;
public:
Line():p1(1,1),p2(2,2)
{
len=sqrt( ( p1.GetX()-p2.GetX())*(p1.GetX()-p2.GetX())+(p1.GetY()-p1.GetY())*(p1.GetY()-p1.GetY()) );
}

Line(Line &l):p1(l.p1),p2(l.p2)
{
cout<<"调用构造函数"<<endl;
}

Line(Point xp1,Point xp2):p1(xp1),p2(xp2)
{
len=sqrt( ( p1.GetX()-p2.GetX())*(p1.GetX()-p2.GetX())+(p1.GetY()-p1.GetY())*(p1.GetY()-p1.GetY()) );
}

float GetLen()
{
return len;
}
Point GetPoint1()
{
return p1;
}
Point GetPoint2()
{
return p2;
}
};

int main()
{
Point p1(10,10);
Point p2(1,1);
Line l1();
Line l2(p1,p2);

return 0;
}
编译器 设计

------解决方案--------------------
1. sqrt可以重载,编译器可能不知道你希望调用哪个sqrt。
2. GetX和GetY函数没有定义体,造成链接错误。
3. Line l1();这句话并不是定义一个对象l1,编译器会认为你是在声明一个函数,这个函数的返回类型是Line,函数名是l1,函数参数为空。

参考修改代码如下
#include<iostream>
#include<cmath>
using namespace std;
class Point{
private:
int x,y;
public:
Point()
{
x=0;
y=0;
}
Point(int x,int y)
{
this->x=x;
this->y=y;
}
Point(Point &p)
{
x=p.x;
y=p.y;
}

int GetX();
int GetY();
void SetX();
void SetY();
};

int Point::GetX(){return x;}
int Point::GetY(){return y;}

class Line{
private:
Point p1,p2;
float len;
public:
Line():p1(1,1),p2(2,2)
{
len=sqrt( (double)( p1.GetX()-p2.GetX())*(p1.GetX()-p2.GetX())+(p1.GetY()-p1.GetY())*(p1.GetY()-p1.GetY()) );
}

Line(Line &l):p1(l.p1),p2(l.p2)
{
cout<<"调用构造函数"<<endl;
}

Line(Point xp1,Point xp2):p1(xp1),p2(xp2)
{
len=sqrt( (double)( p1.GetX()-p2.GetX())*(p1.GetX()-p2.GetX())+(p1.GetY()-p1.GetY())*(p1.GetY()-p1.GetY()) );
}

float GetLen()
{
return len;
}
Point GetPoint1()
{
return p1;
}
Point GetPoint2()
{
return p2;
}
};

int main()
{
Point p1(10,10);
Point p2(1,1);
Line l1;
Line l2(p1,p2);

return 0;
}