Source of ListNode.h


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

  4: template<class ItemType>
  5: class ListNode // A node on the list
  6: {
  7: private:
  8:    ItemType item;                        // A data item on the list
  9:    std::shared_ptr<Node<ItemType>> next; // Pointer to next node
 10:    
 11:    Node();
 12:    Node(const ItemType& nodeItem, std::shared_ptr<Node<ItemType>> nextNode);
 13:    
 14:    // Friend class – can access private parts
 15:    template<class friendItemType>
 16:    friend class LinkedList<friendItemType>;
 17: }; // end ListNode