class Box {
    public:
	Box();
	~Box();
	Box(const Box & other);
	Box & operator = (const Box & other);
	int getValue() const;
	void setValue(int val);
    private:
	int *value; // pointer to heap allocated value
};

Box::Box()
{ 
    value = new int;
    *value = 0; 
}

Box::~Box()
{ 
    delete value; 
}

Box::Box(const Box & other)
{ 
    value = new int;
    *value = *other.value; 
}

Box & Box::operator = (const Box & other)
{
    if (&other == this)
        return *this;
	
    //copy value and return   
    *value = *other.value;
    return *this; 
}

int Box:: getValue()
const
{
    return *value;
}

void Box:: setValue(int val)
{
    *value = val;
}