class Point
{
public:
void initPoint(float x = 0, float y = 0)
{
this->x = x; this->y = y;
}
void move(float offx, float offy)
{
x += offx; y += offy;
}
float getx() const { return x; }
float gety() const { return y; }
private:
float x, y;
};
class Rectangle :public Point
{
void initRectangle(float x, float y, float w, float h)
{
initPoint(x, y);
this->w = w;
this->h = h;
}
float geth() const { return h; }
float getw() const { return w;}
private:
float w, h;
};
!真要写还是首选组合