#include <iostream>
using namespace std;
class Box
{
public:
	static int objectCount;
	Box(double l = 1.0,double b = 2.0,double h=3.0)
	{
		cout << "Constructor called" << endl;
		length = l;
		breadth = b;
		height = h;
		// 每次创建对象时加1
		objectCount++;
	}

	double volume()
	{
		return length * breadth*height;
	}
private:
	double length;
	double breadth;
	double height;
};

// 初始化类Box的静态成员
int Box::objectCount = 0;

int main(void)
{
	Box Box1(3.3, 1.2, 1.5);
	Box Box2(8.5,6.0,2.0);

	// 输出对象的总数
	cout << "Total Objects:" << Box::objectCount << endl;
	system("pause");
	return 0;
}