== Part 2: Templated Linked List ==
Do NOT start working on this part before finishing part 1 and making sure that it passes all tests!'''
For this part, you will build the classes '''List<T> ''' and '''ListNode''' in the file '''list.h'''. These two classes compose a templated linked list . A lot of the code for these classes is '''very similar''' to the code you already wrote for the IntListNode and IntList classes, except that the code is now templated. Therefore, it is suggested that you '''copy''' the code that you wrote for those classes and '''paste''' it into the list.h file, updating the references to IntListNode and IntList and generally adjusting the code as required.
NOTE:''' The function signature for ListNode::ListNode, ListNode::val setter, and List::push are different from their IntListNode and IntList counterparts!
=== Class: ListNode<T>, Files: [list.h], Test: 1 ===
Templated ListNode class. Similar to IntListNode but templated to hold any type.
It is expected that '''class declaration''' and '''definition''' lie in '''list.h'''. In most implementations, you will need to make the class '''List<T>''' a friend of this class to access the protected '''next setter'''. '''TIP:''' The syntax for prototyping a templated class is:
template <typename T> SomeClass;
The exact specs follow and assume that the template: ==== Internal Variables ==== ; T _val: Held value. ; ListNode<T>* _next: Pointer to the next node in the list . ==== Protected Functions ==== ; void next(ListNode<T>*): Next setter. Sets the internally held next pointer to the incoming pointer.
==== Public Functions ====