Defining append()
The stub of append() should look like this:
void List::append(const Item& it) {
}
The steps append() should take are:
- Dynamically allocate a new Node
in which myItem is it and
myNext is nullptr;
save its address in nodePtr.
- If I am empty:
- Make myFirst point at the new node (using nodePtr).
Otherwise:
- Make myLast->myNext point at the new node (using nodePtr).
- Make myLast point at the new node (using nodePtr).
- Increment mySize.