The stub of remove() should look like this:
Item LinkedQueue::remove() {
}
The remove() method should behave as follows:
- If the queue is empty, throw an EmptyQueueException;
- Otherwise:
- Store the item in the oldest node (the one pointed to by myFirst) into local variable result;
- Save the address of the oldest node in a local variable nPtr;
- Make myFirst point at the next-oldest node in the queue (or NULL if there is none);
- Set the myNext member of the oldest node to NULL;
- Deallocate the oldest node;
- Subtract 1 from mySize; and
- Return result.