class circle
{
float radius;
float area;
public:
circle(float r)
{radius=r; }
float getarea(void)
{area=3.14*radius*radius; return area;}
};
class table
{
float height;
public:
table(float h)
{height=h;}
float getheight(void)
{return height;}
};
class roundtable : public table, public circle
{
TColor color;
public:
roundtable(float h,float r,TColor c):circle(r), table(h)
{color=c;}
TColor getcolor(void)
{return color;}
};
设计一个园类circle和一个桌子类table,circle类包括私有数据成员半径radius和求圆面积得成员函数getarea():table类包含私有数据成员height(高度)和返回高度的成员函数getheight().另设计一个圆桌
设计一个园类circle和一个桌子类table,circle类包括私有数据成员半径radius和求圆面积得成员函数getarea():table类包含私有数据成员height(高度)和返回高度的成员函数getheight().另设计一个圆桌类roundtable,它是从前两个类的派生,roundtable类继承所有上述类得数据成员和成员函数,添加了私有数据成员color和相应的成员函数.要求输出一个圆桌得高度、面积和颜色等数据.
其他人气:856 ℃时间:2019-12-13 17:39:02
优质解答
我来回答
类似推荐
猜你喜欢
- 1若函数y=4x与y=1/x的图象有一个交点是(1/2,2),则另一个交点坐标是_.
- 2初中物理电学故障并联电路和串联电路的故障是不是一样的
- 3三个数成等比数列,和为26,平方和为364求这三个数
- 4有一群鸽子和一些笼子,如每个鸽笼住6只鸽子,则剩3只无鸽笼可住
- 5核裂变(聚变)是物理还是化学变化?
- 6gravity weight 用法示例及说明谢谢
- 7he has already seen the fime改为否定句与一般疑问句,并做否定回答
- 8月亮上的足迹用一句话概括课文内容
- 9数学题小公车15辆,大轿车是小公车的一又五分之三倍,货车比大轿车少三分之一,求小货车比大轿车少多少辆?
- 102的五十次方乘以五十等于多少