C++编程: 定义一个名为juxing的矩形类,其中包括宽和长属性,包括不带参数的构造函数(构造函
#include<iostream>
using namespace std;
class juxing{
public:
juxing()
wid=0;
length=0;
cout<<"构造函数被调用"<<endl;
}
juxing(int w,int l)
{
wid=w;
length=l;
cout<<"构造函数被调用"<<endl;
}
juxing(const juxing &first)
{
this.wid=first.wid;
this.length=first.length
}
~juxing()
{
cout<<"析构函数被调用"<<endl;
}
private:
int wid;
int length;
};
int main()
{
juxing a(10,8);
juxing b=a;
}