类的继承和派生——求圆柱表面积
利用基类、派生类编写一个程序计算Point类、Circle类派生所得Cylinder类的表面积。
#include<iostream>
using namespace std;
#define PI 3.14
class Point{//定义Point类
private:
int X,Y;//坐标
public:
Point(int X=0,int Y=0){//带参数构造函数
this->X=X;
this->Y=Y;
}
void Sh
原创
2021-11-12 17:33:30 ·
794 阅读 ·
0 评论