Changes

Jump to: navigation, search

Project A3 20141 - OOP344

73 bytes added, 09:32, 3 April 2014
Part 2: Templated Linked List: Updated important to standout
These two classes are almost identical to IntListNode and IntList, except that they are templated.
In the specs below, note the sections that are marked '''<big><u><i>Important'''</i></u></big>. Those sections will have more than just a template parameter change from the int version of the list.
=== Class: ListNode<T>, Files: [list.h], Test Number: 1 ===
; Constructor: Accepts two arguments.
;:* '''<big><u><i>Important'''. Const </i></u></big> const T reference to initialize node's value. Defaults to a default constructed T.;:* Pointer to next node in the list. Defaults to NULL.
; Copy Constructor: Initializes internal value as a copy of the source's internal value. Sets this object's next pointer to NULL.
; Standard Assignment Operator: Assigns source's internal value to the current object's internal value. Sets this object's next pointer to NULL. Does not alter the object in the case of self-assignment. Returns a reference to the current object.
; val: Val getter. Const function. Does not accept parameters. Returns internal value.
; val: Val setter. '''<big><u><i>Important'''. Receives </i></u></big> receives a const T reference. Sets internal value to received reference. Does not return anything.
; next: Next getter. Const function. Does not accept parameters. Returns pointer to next node.
; head: Head getter. Const function. Returns pointer to head node in list.
; push: Adds a new node to the '''end of the list'''. I'll say that again, '''END OF THE LIST'''. '''<big><u><i>Important'''. Receives </i></u></big> receives a const T reference. The new node's value should be set to the received reference.
; pop: Destroys the '''last node in the list'''. I'll say that again, '''LAST NODE IN THE LIST'''. Does not receive any arguments. Does not return anything.
; clear: Removes all nodes in the list. Has no effect if the list is empty. Does not accept parameters. Does not return anything.

Navigation menu