1: // Created by Frank M. Carrano and Timothy M. Henry.
2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.
4: template <class ItemType>
5: LinkedList<ItemType>& LinkedList<ItemType>::operator=(const LinkedList<ItemType>& rightHandSide)
6: {
7: // Check for assignment to self
8: if (this != &rightHandSide)
9: {
10: this->clear(); // Deallocate left-hand side
11: copyListNodes(rightHandSide); // Copy list nodes
12: itemCount = rightHandSide.itemCount; // Copy size of list
13: } // end if
14:
15: return *this;
16: } // end operator=