在已有的Point类的基础上,定义一个“Circle”派生类,要求:新增一个半径成员;能计
算并输出圆的周长及加圆面积
#ifndef __Dervide_circle__circle__
#define __Dervide_circle__circle__
#include
using namespace std;
#define PI 3.1415926
class point
{ private:
float x,y;
public:
point(void)
{x=0;y=0;}
point(float a,float b)
{x=a ; y=b; }
point(const point &ob)
{x=ob.x;y=ob.y;}
void set_point(float a,float b);
float read_x(void);
float read_y(void);
float read_x(void) const;
float read_y(void) const;
void move(float a,float b);
void move(float a,float b) const;
};
class circle :public point
{
public:
circle(float a ,float b ,float c):point(a,b)
{r = c;}
void set_r(float a){r = a;}
float Get_R(){return r;}
void circumference();
void squire();
private:
float r;
};
void point::set_point(float a,float b)
{x=a ; y=b; }
float point::read_x(void)
{ return x;}
float point::read_y(void)
{ return y;}
void point::move (float a,float b)
{ x+=a;y+=b;}
float point::read_x(void) const
{ return x;}
float point::read_y(void) const
{ return y;}
//void point::move (float a,float b) const
// { x+=a;y+=b;}
void circle::circumference()
{
float c = 2*PI*r;
cout"周长=""" endif="" float="" pre="" s="PI*r*r;" void="">
class="brush:java;">#include"circle.h"
int main()
{
circle C(1.2,2.0,3.0);
cout"" return="">