继承 代码
#include
#define PI 3.14
using namespace std;
class Shape
{
protected:
double perimeter;
double area;
public:
Shape() {
cout<<"Shape::无参构造"<area = other.area;
this->perimeter = other.perimeter;
}
cout<<"Shape::拷贝赋值"<area = other.area;
this->perimeter = other.perimeter;
this->r = other.r;
}
cout<<"Shape::拷贝赋值"<perimeter = 2*PI*this->r;
this->area = PI*r*r;
cout<<"周长是:"<perimeter<area<len = other.len;
this->wid = other.wid;
}
cout<<"Shape::拷贝赋值"<perimeter = 2*(len+wid);
this->area = len*wid;
cout<<"周长是:"<perimeter<area<