9月12日作业

作业代码

#include 

using namespace std;

class Shape
{
protected:
    double cir;
    double area;
public:
    //无参构造
    Shape() {cout<<"无参构造"<cir = other.cir;
            this->area = other.area;
            cout<<"拷贝赋值"<cir = other.cir;
        this->area = other.area;
        return *this;
    }
};

class Circle:public Shape
{
private:
    double rad;
public:
    //无参构造
    Circle() {cout<<"无参构造"<rad = other.rad;
            cout<<"拷贝赋值"<rad = other.rad;
        return *this;
        cout<<"移动赋值"<len = other.len;
        this->width = other.width;
        return *this;
    }
    //移动赋值
    Rect& operator=(Rect&& other)
    {
        this->len = other.len;
        this->width = other.width;
        return *this;
    }
    //获取周长
    double get_cir()
    {
        Shape::cir = (len+width)*2;
        return Shape::cir;
    }
    //获取面积
    double get_area()
    {
        Shape::area = len*width;
        return Shape::area;
    }
};

int main()
{
    Circle c(3);
    cout<<"c_cir = "<运行截图

9月12日作业_第1张图片思维导图

9月12日作业_第2张图片

模拟面试

9月12日作业_第3张图片

你可能感兴趣的:(c++)