//Ex6_14.cpp
#include "iostream" 
using namespace std;
class Circle 
{private: 
    double x,y,r; 
 public: 
   void dispaly()   //显示圆的信息
	{cout<<"O("<<x<<","<<y<<"),R-"<<r<<endl;}
   void set(double x1,double y1,double r1) 
	{x=x1; y=y1; r=r1; } 
   double getr()   //为派生类能使用圆的半径提供一个接口 
	{return r;} 
}; 
class Cylinder:public Circle 
{private: 
    double h; 
 public: 
    void dispaly() 
	{Circle::dispaly();   //调用基类同名的成员函数时需指明所属的类
     cout<<"H-"<<h<<endl;} 
	void set(double x1,double y1,double r1,double h1) 
	{Circle::set(x1,y1,r1); h=h1; }  //调用基类同名的成员函数时需指明所属的类
	double volume() 
	{double R=getr(); 
	 return(3.14*R*R*h);} 
}; 
void main() 
{Cylinder p; 
 p.set(0,0,2,3); 
 p.dispaly(); 
 cout<<"V="<<p.volume()<<endl; 
}
