Source of copyConstructor.cpp


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.

  4: template<class ItemType>
  5: SortedListHasA<ItemType>::SortedListHasA(const SortedListHasA<ItemType>& sList)
  6:                                                : listPtr(std::make_unique<LinkedList<ItemType>>())
  7: {
  8:         // Add items to a new list using public methods
  9:         for (int position = 1; position <= sList.getLength(); position++)
 10:         {
 11:                 listPtr->insert(position, sList.getEntry(position));
 12:         }  // end for
 13: }  // end copy constructor