#include<iostream>
#include<cassert>
using namespace std;
class point
{
public:
point()//point():x(0),y(0);
{
cout<<"no number"<<endl;
}
point(int x,int y)//point(int x,int y):x(x),y(y)
{
this->x=x;
this->y=y;
cout<<"construct"<<endl;
}
int getx(){return x;}
int gety(){return y;}
void move(int nx,int ny)
{
x=nx;
y=ny;
}
~point(){cout<<"free"<<endl;}
private:
int x,y;
};
class arrayofpoints{
public:
arrayofpoints(int size):size(size)
{
points=new point[size];
}
~arrayofpoints()
{
cout<<"delete free"<<endl;
delete []points;
}
point &element(int index)
{
assert(index>=0&&index<size);
return points[index];
}
private:
point *points;
int size;
};
int main()
{
int count=3;
arrayofpoints points(count);
points.element(0).move(5,0);
points.element(1).move(15,20);
return 0;
}