#pragma once #include // Forward declaration of LinkedList template class LinkedList; /// /// Template class to allow the LinkedListNode to store any data type /// /// Value type template class LinkedListNode { private: T _value; // Value of the node LinkedListNode* _next; // Pointer to the next node in the linked list public: /// /// Linked list item constructor /// /// The value of the node /// The next node in the linked list LinkedListNode(const T& value, LinkedListNode* next); /// /// Retrieve the value of the node /// /// The respective value for the node const T& getValue() const; /// /// Retrieve next node in the linked list /// /// Next linked node LinkedListNode* getNext(); /// /// Assigns the item new value /// /// The value to be replaced with /// New linked list item LinkedListNode& operator=(const LinkedListNode& other); template friend class LinkedList; }; // Implementation of LinkedListNode template LinkedListNode::LinkedListNode(const T& value, LinkedListNode* next) : _value(value), _next(next) {} template const T& LinkedListNode::getValue() const { return _value; } template LinkedListNode* LinkedListNode::getNext() { return _next; } template LinkedListNode& LinkedListNode::operator=(const LinkedListNode& other) { if (this != &other) { _value = other._value; _next = other._next; } return *this; }