#include <iostream>
using namespace std;

class Line
{
public:
	void setLength(double len);
	double getLength(void);

	// 构造函数,在每次创建新的对象时执行
	Line();
	// 析构函数,在每次删除所创建的饿对象时执行
	~Line();

private:
	double length;
};

Line::Line(void)
{
	cout << "object is created" << endl;
}

Line::~Line(void)
{
	cout << "object is delted" << endl;
}

void Line::setLength(double len)
{
	length = len;
}

double Line::getLength(void)
{
	return length;
}

int main()
{
	Line line;
	line.setLength(6.0);
	cout << "Length of line:" << line.getLength() << endl;

	system("pause");

	return 0;
}