#include<iostream.h>
class point	//基类point类的定义
{
public:	//公有成员函数
	point(float xx=0, float yy=0);
    point(point &p);
	~point();
	void display(void);
protected:	//保护数据成员
	float x;
	float y;
};
point::point(float xx,float yy)
{
    x=xx;
	y=yy;
    cout<<"point类的构造函数被调用"<<endl;
}
point::point(point &p)
{
    x=p.x;
	y=p.y;
}
point::~point()
{
 cout<<"point类的析构函数被调用"<<endl;
}

void point::display(void)
{
	cout<<"x="<<x<<" y="<<y<<endl;
}
class circle: public point	//公有继承
{
public:	//新增公有函数成员
    circle(float a, float b,float c);//初始化
    circle(circle &p);
	~circle();
	void display(void);
	float get_cum(void);
	float get_area(void);
private:	//新增私有数据成员
	float r;
};
circle::circle(float a, float b, float c):point(a,b)
{
	r=c;
    cout<<"circle类的构造函数被调用"<<endl;
}
circle::circle(circle &p):point(p.x,p.y)
{
   r=p.r;
}
circle::~circle()
{
  cout<<"circle类的析构函数被调用"<<endl;
}
void circle::display(void)
{
	cout<<"r="<<r<<" x="<<x<<" y="<<y<<endl;
	point::display();
}
float circle::get_cum(void)
{
    return(2*3.14*r);
}
float circle::get_area(void)
{
    return(3.14*r*r);
}
int main()
{
	circle c(0,0,1);	//定义circle类的对象
	c.display();	//显示数据
    cout<<"周长:"<<c.get_cum()<<endl;
	cout<<"面积:"<<c.get_area()<<endl;
	return(0);
}
