1: // Created by Frank M. Carrano and Timothy M. Henry. 2: // Copyright (c) 2017 Pearson Education, Hoboken, New Jersey. 4: // Listing C4-2 6: #include "Node.h" 8: template<class ItemType> 9: Node<ItemType>::Node() 10: { } // end default constructor 12: template<class ItemType> 13: Node<ItemType>::Node(const ItemType& anItem): item(anItem) 14: { } // end constructor 16: template<class ItemType> 17: Node<ItemType>::Node(const ItemType& anItem, 18: std::shared_ptr<Node<ItemType>> nextNodePtr) 19: : item(anItem), next(nextNodePtr) 20: { } // end constructor 22: template<class ItemType> 23: void Node<ItemType>::setItem(const ItemType& anItem) 24: { 25: item = anItem; 26: } // end setItem 28: template<class ItemType> 29: void Node<ItemType>::setNext(std::shared_ptr<Node<ItemType>> nextNodePtr) 30: { 31: next = nextNodePtr; 32: } // end setNext 34: template<class ItemType> 35: ItemType Node<ItemType>::getItem() const 36: { 37: return item; 38: } // end getItem 40: template<class ItemType> 41: auto Node<ItemType>::getNext() const 42: { 43: return next; 44: } // end getNext