******************************************************************************
NOTE: MODIFY YOU Delete FUNCTION 
in double.h
if(k == 1)
{
         // set current to LeftEnd
         // set LeftEnd to current's right
         if(LeftEnd == 0) RightEnd = LeftEnd;
	 else LeftEnd->left = 0; // This line is probably missing
}


FOR THE CASE k == length

current = RightEnd;
RightEnd = current->left;
RightEnd->right = 0; // This line probably is missing in your code
*******************************************************************************

Use the following code to write copy constructor and 
assignment operator.

Note that you need to create a private function called
destroy, which is the same as destructor.

In fact, you destructor should be modified to call destroy.

Do the same for Double.

Make sure that lab7.cxx works properly. First for Chain
and then for Double.

template<class T>
Chain<T>::Chain(const Chain<T>& old)
{
	ChainNode<T>* current = old.first;
	ChainNode<T>* NewCurrent = new ChainNode<T>;
	if(current)
	{
		NewCurrent->data = current->data;
		current = current->link;
		first = NewCurrent;
	}
	else
		first = 0;

	while(current)
	{
		ChainNode<T> *NewNode = new ChainNode<T>;
		NewNode->data = current->data;
		NewCurrent->link = NewNode;
		NewCurrent = NewNode;
		current = current->link;
	}
}

template<class T>
Chain<T>& Chain<T>::operator=(const Chain<T>& old)
{
	if(this == &old) return *this;
	if(first)Destroy();
	ChainNode<T>* current = old.first;
	ChainNode<T>* NewCurrent = new ChainNode<T>;
	if(current)
	{
		NewCurrent->data = current->data;
		current = current->link;
		first = NewCurrent;
	}
	else
		first = 0;

	while(current)
	{
		ChainNode<T> *NewNode = new ChainNode<T>;
		NewNode->data = current->data;
		NewCurrent->link = NewNode;
		NewCurrent = NewNode;
		current = current->link;
	}
	return *this;
}
