#include
#include
class Point
{
private:
int _x;
int _y;
public:
Point(int x,int y)
{
this->_x=x;
this->_y=y;
}
int getX()
{
return this->_x;
}
int getY()
{
return this->_y;
}
};
class Rectangle:public Point
{
private:
int _width;
int _height;
public:
Rectangle(int x,int y,int width, int height):Point(x,y)
{
this->_width=width;
this->_height=height;
}
int getWidth()
{
return this->_width;
}
int getHeight()
{
return this->_height;
}
};
class Cube
{
private:
int _width;
int _height;
int _depth;
public:
Cube(int width,int height,int depth)
{
this->_width=width;
this->_height=height;
this->_depth=depth;
}
int getWidth()
{
return this->_width;
}
int getHeight()
{
return this->_height;
}
int getDepth()
{
return this->_depth;
}
};
int main(void)
{
Point *p=new Point(1,2);
printf("the point x is %d, y is %d\n",p->getX(),p->getY());
Rectangle *r=new Rectangle(3,4,5,6);
printf("the rectangle is position is (%d,%d) and width is %d, height is %d\n",(*r).getX(),(*r).getY(),(*r).getWidth(),(*r).getHeight());
Cube c(7,8,9);
printf("the cube's width is %d, height is %d, depth is %d\n",c.getWidth(),c.getHeight(),c.getDepth());
exit(0);
}