/*
*Copyright(c)2016,烟台大学计算机学院
*All right reserved.
*文件名称:test.cpp
*作者:黄金婵
*完成日期:2016年6月11日
*版本号:v1.0
*
*问题描述:再以Circle类为直接基类,派生出一个Cylinder(圆柱体)类,再增加数据成员h(高),,以及求圆柱表面积的成员函数area和求圆柱体积的成员函数volume,实现需要的成员函数,并设计main函数完成测试。
*输入描述:
*程序输出:
*/
#include <iostream>
using namespace std;
class Point
{
public:
Point(double x=0,double y=0);
void setPoint(double,double);
double getX( ) const
{
return x;
}
double getY( ) const
{
return y;
}
void show();
protected:
double x,y;
};
Point::Point(double a,double b)
{
x=a;
y=b;
}
void Point::setPoint(double a,double b)
{
x=a;
y=b;
}
void Point::show()
{
cout<<"["<<x<<","<<y<<"
c++实践参考:圆柱
最新推荐文章于 2022-11-28 12:40:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)