#include <iostream>
using namespace std;
class Box
{
public:
	Box(int h=10,int w=12,int len=15):height(h),width(w),length(len){}//声明有默认参数的构造函数,参数初始化表初始化数据成员
	int volume();
private:
	int height;
	int width;
	int length;
};
int Box::volume()
{
	return(this->height*this->width*this->length);
}
int main()
{
	Box a[3]={      //定义对象数组
		Box(10,12,15),
		Box(18,20),
		Box(16,20,26)
	};
	for(int i=0;i<3;i++)//用循环调用a【0】,a【1】,a【2】.volume;
		cout<<"volume of a["<<0<<"] is "<<a[i].volume()<<endl;
	return 0;
}