#include
#include"Point"
#include"Line"
#include
using namespace std;
Point::Point(Point &p)
{ x=p.x;
y=p.y;
cout<<"复制构造函数"<
cout<<"Calling constructor of Linr"<
double y=static_cast
len=sqrt(x*x+y*y);
}
Line::Line(Line &l):p1(l.p1),p2(l.p2){
cout<<"Calling the copy constructor of Line"<
}
int main(){
Point myp1(1,1),myp2(4,5);
Line line(myp1,myp2);
line line2(line);
cout<<"The length of the line is:"<
}
两个头文件 一个Point类 一个Line类
Point类的无法运行
class Point{
public:
Point(int xx=0,int yy=0){
x=xx;
y=yy;
}
Point(Point &p);
int getX() {return x;}
int getY() {return y;}
private:
int x,y;
};
class Line{
public:
Line(Point xp1,Point xp2);
Line(Line &l);
double getLen()
{return len};
private:
Point p1,p2;
double len;
};
提示的错误是错误 1 fatal error C1083: 无法打开包括文件:“Point”: No such file or directory c:\users\student\desktop\xuxiaowei.cpp 2 xuxiaowei