#include <iostream>
using namespace std;
class Box{
public :
double getVolume(){
return length * breadth * height;
}
void setLength(double len){
length = len;
}
void setBreadth(double brea){
breadth = brea;
}
void setHeight(double hei){
height = hei;
}
Box operator+(const Box &b){
Box box;
box.length = this->length + b.length;
box.breadth = this->breadth + b.breadth;
box.height = this->height + b.height;
return box;
}
private:
double length;
double breadth;
double height;
};
int main()
{
Box box1, box2, box3;
box1.setLength(1.0);
box1.setBreadth(2.0);
box1.setHeight(3.0);
box2.setLength(4.0);
box2.setBreadth(5.0);
box2.setHeight(6.0);
box3 = box1 + box2;
cout << "box3的volume:" << box3.getVolume() << endl;
return 0;
}