#include<iostream>
using namespace std;
class Box
{
public:
Box();
Box(int h,int w,int len):height(h),width(w),length(len) {}
int volume();
private:
int height;
int width;
int length;
};
Box::Box()
{
height=10;
width=10;
length=10;
}
int Box::volume()
{
return(height*width*length);
}
int main()
{
Box Box1,Box2(15,30,25);
cout<<"The volume of the box1 is"<<Box1.volume()<<endl;
cout<<"The volume of the box2 is"<<Box2.volume()<<endl;
return 0;
}
![](https://img-blog.csdn.net/20130728203214656?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd2FuZ2t1bl9f/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)