文件名称:du
- 所属分类:
- Internet/网络编程
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2017-10-06
- 文件大小:
- 1.02mb
- 下载次数:
- 0次
- 提 供 者:
- 嘟嘟2***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
定义一个包含两个纯虚函数的抽象类shape:
class shape
{
public:
virtual float Area()=0;
virtual void SetData(float,float=0)=0;
};
成员函数SetData用于设置几何图形的属性值。成员函数Area()用于求出几何图形的面积。由shape派生出四种几何图形,分别是:三角形、矩形、正方形和圆形。
其它图形的派生类请自行编写。派生类的类名和属性如下:
1)类名 triangle 属性:三角形的一边长w和此边上的高h
2)类名 rectangle 属性:矩形的长w和宽h
3)类名 square 属性:正方形边长s
4)类名 circle 属性:圆的半径r
要求利用虚函数实现多态,编写一个求几何图形面积的普通函数CaclArea(shape *),其参数为抽象类shape的指针
在主函数中定义四种几何图形的对象,调用CaclArea()求四种几何图形对象的面积之和。(The member function SetData is used to set the property values of the geometry. The member function Area () is used to calculate the area of a geometric figure. Four geometric shapes derived from shape are triangle, rectangle, square and circle.
Other graphics derived class, please write your own. The class name and properties of the derived class are as follows:
1) class triangle attribute: triangle side length W and the edge of the high
2) class name rectangle property: rectangle long w and wide H
3) class name square property: square side length s
4) the class name circle property: the radius of the circle R
Requires the use of virtual functions to achieve polymorphism, the preparation of a geometric surface area of the common function CaclArea (shape *), its parameters for the abstract class shape pointer
Define four geometry objects in the main function and call CaclArea () to find the sum of the area of the four geometry objects.)
class shape
{
public:
virtual float Area()=0;
virtual void SetData(float,float=0)=0;
};
成员函数SetData用于设置几何图形的属性值。成员函数Area()用于求出几何图形的面积。由shape派生出四种几何图形,分别是:三角形、矩形、正方形和圆形。
其它图形的派生类请自行编写。派生类的类名和属性如下:
1)类名 triangle 属性:三角形的一边长w和此边上的高h
2)类名 rectangle 属性:矩形的长w和宽h
3)类名 square 属性:正方形边长s
4)类名 circle 属性:圆的半径r
要求利用虚函数实现多态,编写一个求几何图形面积的普通函数CaclArea(shape *),其参数为抽象类shape的指针
在主函数中定义四种几何图形的对象,调用CaclArea()求四种几何图形对象的面积之和。(The member function SetData is used to set the property values of the geometry. The member function Area () is used to calculate the area of a geometric figure. Four geometric shapes derived from shape are triangle, rectangle, square and circle.
Other graphics derived class, please write your own. The class name and properties of the derived class are as follows:
1) class triangle attribute: triangle side length W and the edge of the high
2) class name rectangle property: rectangle long w and wide H
3) class name square property: square side length s
4) the class name circle property: the radius of the circle R
Requires the use of virtual functions to achieve polymorphism, the preparation of a geometric surface area of the common function CaclArea (shape *), its parameters for the abstract class shape pointer
Define four geometry objects in the main function and call CaclArea () to find the sum of the area of the four geometry objects.)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
du
du\Debug
du\Debug\du.exe
du\Debug\du.ilk
du\Debug\du.pch
du\Debug\du.pdb
du\Debug\vc.obj
du\Debug\vc60.idb
du\Debug\vc60.pdb
du\du.dsp
du\du.dsw
du\du.plg
du\vc.cpp
du\Debug
du\Debug\du.exe
du\Debug\du.ilk
du\Debug\du.pch
du\Debug\du.pdb
du\Debug\vc.obj
du\Debug\vc60.idb
du\Debug\vc60.pdb
du\du.dsp
du\du.dsw
du\du.plg
du\vc.cpp