| 108 | } |
| 109 | |
| 110 | void Truckload::addBox(SharedBox box) |
| 111 | { |
| 112 | auto package{ new Package{box} }; // Create a new Package |
| 113 | |
| 114 | if (m_tail) // Check list is not empty |
| 115 | m_tail->m_next = package; // Append the new object to the tail |
| 116 | else // List is empty |
| 117 | m_head = package; // so new object is the head |
| 118 | |
| 119 | m_tail = package; // Either way: the latest object is the (new) tail |
| 120 | } |
| 121 | |
| 122 | bool Truckload::removeBox(SharedBox boxToRemove) |
| 123 | { |