我使用两个Point来定义一个Line和一个LineSegment,例如:classPoint{...};classLine{Pointp1,p2;//...};classLineSegment{Pointp1,p2;//...};LineSegment与Line的定义相同,所以我一开始使用了typedefLineLineSegment而不是定义另一个LineSegment类。但是很快,我发现我无法定义函数distance来计算点与线或点与线段之间的距离。classPoint{...};classLine{Pointp1,p2;//...};typedefLineLineSegment