#include
#include
using namespace std;
class Point
{
public:
Point(double X=0,double Y=0)
{
x=X;
y=Y;
}
void Show()const;
friend double distance1(const Point &p1,const Point &p2);
private:
double x,y;
};
void Point::Show()const
{
cout<<"("<
double distance1(const Point& p1, const Point& p2) //函数命名和cmath库里的函数一样,所以报错
{
return sqrt((p1.x-p2.x)* (p1.x-p2.x)+ (p1.y-p2.y)*(p1.y-p2.y));
}
int main()
{
Point a(1,1),b(3,4); //a要是有参的
a.Show();
b.Show();
cout<
}