求解!!!!!!
#include<iostream>
using namespace std;
class Point
{
public:
Point()
{
X=Y=0;
cout<<"default constructor called."<<endl;
}
Point(int xx,int yy)
{
X=xx;Y=yy;
cout<<"construnctor called."<<endl;
}
~Point()
{
cout<<"destrctor called."<<endl;
}
int GetX(){return X;}
int GetY(){return Y;}
void Move(int x,int y)
{
X=x;
Y=y;
}
private:
int X,Y;
};
class ArrayOfPoints
{
public:
ArrayOfPoints(int n)
{
numberOfPoints=n;
points=new Point[n];
}
~ArrayOfPoints()
{
cout<<"deleting "<<endl;
numberOfPoints=0;
delete [] points;
}
Point & Element(int n)//这句又是什么意思
{
return points[n];
}
private:
Point *points;
int numberOfPoints;
};
void main()
{
int number;
cout<<"please enter the number of points:";
cin>>number;
ArrayOfPoints points(number);//这句什么意思
points.Element(0).Move(5,10);
points.Element(1).Move(15,20);
}