风暴骑兵加点2017:C++类问题?不必给出详细代码,

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 15:21:37
给出类的定义,不必写出方法代码

1.用C++的类体系结构定义一个图形类体系结构,可以完成画点、画圆、画直线、画矩形及画三角形的功能,并可以利用虚函数自动计算不同图形的面积。

大家帮个忙啊?

class shape
{
public:

Point sp; //原坐标
Shape(int x=0;int y=0;){sp.x=x;sp.y=y;}
virtual int CountMM()=0;
virtual void Drawmyself()=0;
};

class po: public shape
{
void Drawmyself();
};
class circle:public shape
{
int r;
public:
Drawmyself();
};
class line:public shape
{
};
...