#include <iostream>
#include <string>
#include <math.h>
using namespace std; class Cvbs
{
public:
Cvbs(double k=1,double h=2){x=k;y=h;};
Cvbs(Cvbs &p);
virtual ~Cvbs();
double getx(){return x;};
double gety(){return y;};
private:
double x,y;
};
Cvbs::Cvbs(Cvbs &p)
{
this->x=p.x;
this->y=p.y;
}
Cvbs::~Cvbs(){}
class chang
{
public:
chang(Cvbs p1,Cvbs p2);
virtual ~chang();
double getle();
private:
double le;
Cvbs xxx,yyy;
};
chang::chang(Cvbs p1,Cvbs p2):xxx(p1),yyy(p2)
{
double xx=fabs(p1.getx()-p2.getx());
double yy=fabs(p1.gety()-p2.gety());
le=sqrt(xx*xx-yy*yy);
}
chang::~chang(){};
double chang::getle()
{
return this->le;
}
int main(int argc,char*argv[])
{
Cvbs cv1(2,2),cv2(5,6);
chang line(cv1,cv2);
cout<<"yi"<<line.getle()<<endl;
return 0;
}
这东西怎么得不到想要的 结果.