day5_C++

day5_C++

  • 继承 代码
  • 思维导图

继承 代码

#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<

思维导图

day5_C++_第1张图片

你可能感兴趣的:(作业,c++,开发语言)