Jump to: navigation, search

Project A3 20141 - OOP344

1,066 bytes removed, 14:49, 2 April 2014
Part 1: Integer Linked List
== Part 1: Integer Linked List ==
For this part, you will build Build the classes '''IntList''' and '''IntListNode''' . Place the headers in the files '''intlist.h''' and '''the implementation in intlist.cpp'''. These two classes compose a basic implementation of form an integer linked list. Please see the following sections on the exact specifications of these classes.
=== Class: IntListNode, Files: [intlist.h, intlist.cpp], Test: 0 ===
An IntListNode is an integer Integer linked list node, as such it holds an integer value and a pointer to an IntListNode that . Node is the next node considered last in the list. If the if its next link pointer 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 listsections below.<br/>While this class is only used by You may need to make IntList, it is expected to have a set friend of its own functionalitythis class.
It is expected that the '''class declaration''' for this class lie in '''intlist.h''' and the definition code lie in '''intlist.cpp'''. In most implementations, you will need to make the class '''IntList''' a friend of this class to access the protected '''next setter'''. The exact specs follow: ==== Internal Variables Recommended Members ====Please note that * An integer member to hold the names provided in all '''Internal Variables''' sections are suggested but '''not mandatory''node'. ; int _val: Held integer s value.; IntListNode* _next: Pointer A pointer to the next node in the list.
==== Protected Functions ====
; void next(IntListNode*): Next setterSetter for this node's next member. Sets the internally held next Accepts a pointer to the incoming pointera node. Does not return anything.
==== Public Functions ====
; IntListNode(int v = int(), IntListNodeConstructor: Accepts two arguments::* n = NULL): ConstructorInteger to initialize node's value. Note the Defaults to a default valuesconstructed int. Initializes the internally held value :* Pointer to v and the next pointer node in list. Defaults to nNULL.; IntListNode(const IntListNode& src)Copy Constructor: Copy constructor. Should initialize Initializes internal value as a copy of the internally held value to srcsource's internally held internal value. Should initialize ''Sets this object's next''' to '''NULL'''.; IntListNode& operator=(const IntListNode& src)Standard Assignment Operator: Assignment operator. Should set the internally held Assigns source's internal value to srcthe current object's internally held internal value. Should set ''Sets this object's next''' to '''NULL'''. Should do '''NOTHING''' Does not alter the object in the case of '''self-assignment''' (ie IntListNode x; x = x;). Returns a reference to the current object.; ~IntListNode(): Destructor. As this node does not allocate any memory, this function can remain empty.
; int val() const: Val getter. Const function. Does not accept parameters. Returns the internal value internally held.; void val(int): Val setter. Receives an int. Sets the internally held internal value to the incoming valuereceived int. Does not return anything.
; IntListNode* next() const: Next getter. Const function. Does not accept parameters. Returns pointer to the internally held next pointernode.
=== Class: IntList, Files [intlist.h, intlist.cpp], Test: 0 ===

Navigation menu