Source of OverloadedOutputStream.cpp


  1: //  Created by Frank M. Carrano and Tim Henry.
  2: //  Copyright (c) 2013 __Pearson Education__. All rights reserved.

  4: // Interlude 5, pp 422.

  6: template<class friendItemType>
  7: ostream& operator<<(ostream& outStream, const LinkedList<friendItemType>& outputList)
  8: {
  9:    int position = 1;
 10:    Node<friendItemType>* currPtr = outputList.headPtr;
 11:    while (currPtr != nullptr)
 12:    {
 13:       outStream << position << "\t" << currPtr->getItem() << endl;
 14:       currPtr = currPtr->getNext();
 15:       position++;
 16:    }
 17:    return outStream;
 18: } // end operator<<