| 64 | } |
| 65 | |
| 66 | void Truckload::addBox(SharedBox box) |
| 67 | { |
| 68 | auto package{ new Package{box} }; // Create a new Package |
| 69 | |
| 70 | if (m_tail) // Check list is not empty |
| 71 | m_tail->setNext(package); // Append the new object to the tail |
| 72 | else // List is empty |
| 73 | m_head = package; // so new object is the head |
| 74 | |
| 75 | m_tail = package; // Either way: the latest object is the (new) tail |
| 76 | } |
| 77 | |
| 78 | bool Truckload::removeBox(SharedBox boxToRemove) |
| 79 | { |