MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / addBox

Method addBox

Exercises/Modules/Chapter 12/Soln12_06/Truckload.cpp:82–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void Truckload::addBox(SharedBox box)
83{
84 auto package{ new Package{box} }; // Create a new Package
85
86 if (m_tail) // Check list is not empty
87 m_tail->m_next = package; // Append the new object to the tail
88 else // List is empty
89 m_head = package; // so new object is the head
90
91 m_tail = package; // Either way: the latest object is the (new) tail
92}
93
94bool Truckload::removeBox(SharedBox boxToRemove)
95{

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected