关于#c++#的问题,请各位专家解答!

如图,如何实现这串代码,定义并实现一个矩形类Crectangle

img

img

#include <iostream>
using namespace std;
 
class Rectangle
{
public:
    Rectangle(double x, double y)
    {
        length = x;
        wide = y;
    }
    Rectangle()
    {
 
    }
    double area(double length, double wide)
    {
        return length * wide;
    }
    void display()
    {
        cout << "length=" << length << " wide=" << wide << " are=" << area(length, wide) << endl;
 
    }
    void setlength(double x)//设置
    {
        length = x;
    }
    void setwide(double y)//设置
    {
        wide = y;
    }
    double getlength()//获取
    {
        return length;
    }
    double getwide()//获取
    {
        return wide;
    }
private:
    double length;
    double wide;
 
};
https://blog.csdn.net/QQ3503814312/article/details/127283479
不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^