// Created by Frank M. Carrano and Tim Henry. // Copyright (c) 2013 __Pearson Education__. All rights reserved. // PARITALLY COMPLETE. /** Implementation file for the class SortedListHasA. @file SortedListHasA.cpp */ #include "SortedListHasA.h" // Header file #include "LinkedList.h" #include #include template SortedListHasA::SortedListHasA() { listPtr = new LinkedList(); } // end default constructor template SortedListHasA::SortedListHasA(const SortedListHasA& sList) { // First, create our own list listPtr = new LinkedList(); // Then add items to it using public methods for(int position = 1; position <= sList.getLength(); position++) { listPtr->insert(position, sList.getEntry(position)); } // end for } // end copy constructor template SortedListHasA::~SortedListHasA() { clear(); } // end destructor template void SortedListHasA::insertSorted(const ItemType& newEntry) { int newPosition = fabs(getPosition(newEntry)); listPtr->insert(newPosition, newEntry); } // end insertSorted //===================== // List operations: template bool SortedListHasA::remove(int position) { return listPtr->remove(position); } // end remove