没注释的源代码
#include <iostream>
using namespace std;
class circle
{
public:
circle(double r){radious=r;}
double area()
{
return 3.14*radious*radious;
}
private:
double radious;
};
class circlur:public circle
{
public:
circlur(double r,double h):circle(r){height=h;}
double volume()
{
return area()*height;
}
private:
double height;
};
int main()
{
circlur stud(5,5);
cout<<"圆柱的体积:"<<stud.volume()<<endl;
return 0;
}