class Circle : public Plane,public Point {
public:
Circle(double x = 0, double y = 0, double r = 0) : Point(x,y), radius(r) {
cout<<"Circle Constructor run" <<endl;
}
Circle(const Circle& c) : Point(c), radius(c.radius) {
cout << "Circle CopyConstructor run" << endl;
}
~Circle() {
cout << "Circle Destructor run" << endl;
}
void setR(double r) {
radius=r;
}
double getR() const {
return radius;
}
virtual void show() const {
cout << "Circle(";
Point::show();
cout << ",Radius=" << radius<<")";
}
virtual double length() const {
return 2 * PI * radius;
}
virtual double area() const {
return PI * radius * radius;
}
protected:
double radius;
static const double PI;
};
const double Circle::PI = 3.14159;
标签:const,cout,Point,double,圆类,Plane,radius,Circle From: https://www.cnblogs.com/jmhyyds/p/17365586.html