Jump to: navigation, search

Project A3 20141 - OOP344

512 bytes added, 03:20, 23 March 2014
Part 2: Templated Linked List: Updated intro
== Part 2: Templated Linked List ==
For this part, you will build the classes '''IntList''' and '''IntListNode''' in the files '''intlist.h''' NOTE: Do NOT start working on this part before finishing part 1 and making sure that it passes all tests!'''intlist.cpp'''. These two classes compose a basic implementation of an integer linked list. Please see the following sections on the exact specifications of these classes.
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::val setter and List::push are different from their IntListNode::val setter and IntList::push counterparts! === Class: IntListNodeListNode, Files: [intlistlist.h, intlist.cpp], Test: 0 1 ===
An IntListNode is an integer linked list node, as such it holds an integer value and a pointer to an IntListNode that is the next node in the list. If the next link is NULL then the current node is considered the '''last node in the list'''.<br/>Note that the next property of this class has a public getter and a protected setter; this is intentional as client code should not mess with the '''structure''' of our linked list.<br/>While this class is only used by IntList, it is expected to have a set of its own functionality.

Navigation menu