#include
#include
#include
using namespace std;
class Point
{
public:
double x,y;
Point(double x,double y)
{
this->x = x;
this->y = y;
cout<<"constructor begin!"<
~Point()
{
cout<<"destructor begin!"<
void show()
{
cout<
double dist(Point p)
{
cout<
}
};
int main()
{
Point p1(2.178, 2.0);
Point p2(3.0, 3.0);
Point p3(6.0, 7.0);
p1.show();
p2.show();
p3.show();
cout << p2.dist(p3) << endl; //两点距离
return 0;
}
题目要求输出如下:constructor begin!constructor begin!constructor begin!Point(2.18,2.00)Point(3.00,3.00)Point(6.00,7.00)5.00destructor begin!destructor begin!destructor begin!我这个代码会输出四个“destructor begin!”,不太懂析构,求修改!谢谢