class Point{
public:
Point();
Point(int x, int y);
voidsetPoint(int x, int y);
int getx();
int gety();
private;
int x, y;
}
Point::Point(){x = y = 0;}
Point setPoint(int _x, int_y){x = _x; y = _y;}
Point::Point(int _x, int _y){setPoint(_x, _y);}
Point::getx(){return this->x;}
Point::gety(){return this->y;}
class Rectangle
{
Point a, b
friend int getSpace();
}
getSpace(Rectangle r)
{
return abs((Rectangle.a.getx() - this->b.getx()) * (Rectangle.a.gety() - this->b.gety()))
}
题目已经很详细了,几乎等于都告诉你怎么写了