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

Method addBox

Examples/NoModules/Chapter 12/Ex12_17/Truckload.cpp:67–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.45

Calls 1

setNextMethod · 0.45

Tested by

no test coverage detected