The stub of append() should look like this:
void LinkedQueue::append(const Item& it) {
}
The append() method should behave as follows:
Try the following:
- Allocate a new Node containing (it, NULL), and store its address in a local variable nPtr.
- If the queue is empty:
- Make myFirst point at the new node;
Otherwise:
- Make the myNext member of the last node
(the one whose address is in myLast) point at the new node;
- Make myLast point at the new node;
- Increment mySize;
Catch the std::bad_alloc exception; if it occurred, throw a FullQueueException.