作业帮 > 综合 > 作业

#include using namespace std;class Box{public:Box(int a,int

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/19 10:17:04
#include
using namespace std;
class Box
{
public:
Box(int a,int b,int c)
{
height=a;
width=b;
length=c;
}
Box(const Box &b)
{
height=b.height;
width=b.width;
length=b.height;
}
int volume()
{
return(height*width*length);
}
private:
int height;
int width;
int length;
};
int main()
{
Box box1(15,30,25);
cout
Box(const Box &b)
{
height=b.height;
width=b.width;
length=b.height; //这里应该是length=b.length
}