Advertisement
Guest User

Untitled

a guest
May 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. virtual void display() const = 0;
  2.  
  3. to QueueInterface, add the declaration
  4.  
  5. void display() const;
  6.  
  7. to the class declaration in the header file, and add the following method definition to the implementation file:
  8.  
  9. template<class ItemType>
  10.  
  11. void LinkedQueue<ItemType>::display() const
  12.  
  13. {
  14.  
  15. Node<ItemType>* curPtr = frontPtr;
  16.  
  17.  
  18.  
  19. while (curPtr != backPtr)
  20.  
  21. {
  22.  
  23. cout << curPtr->getItem() << " "; // Display items on same line
  24.  
  25. curPtr = curPtr->getNext();
  26.  
  27. } // end while
  28.  
  29. cout << backPtr->getItem() << " "; // Display last item
  30.  
  31.  
  32.  
  33. cout << endl; // Terminate output with an end of line
  34.  
  35. } // end display
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement