class ball:public circle // 公有派生 { public: ball(float r1):circle(r1){}; float getsquare(); }; float ball::getsquare() { return(4*circle::getsquare()); } class cylinder:public circle // 公有派生 { private: float height; public: cylinder(float r1,float height1):circle(r1) ...
//1.设计一个基类,从基类派生圆柱,设计成员函数输出它们的面积和体积; #include < iostream > using namespace std; class Basic//基类 { protected: double r; public: Basic() { r = 0; } Basic(double a) :r(a) {} }; class Circular : public Basic//从基类派生圆类 { protected: double area...
//1.设计一个基类,从基类派生圆柱,设计成员函数输出它们的面积和体积; #include < iostream > using namespace std; class Basic//基类 { protected: double r; public: Basic() { r = 0; } Basic(double a) :r(a) {} }; class Circular : public Basic//从基类派生圆类 { protected: double area...