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

Method addBox

Exercises/Modules/Chapter 19/Soln19_05/Truckload.cpp:90–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void Truckload::addBox(SharedBox box)
91{
92 auto package{ new Package{box} }; // Create a new Package
93
94 if (m_tail) // Check list is not empty
95 m_tail->m_next = package; // Append the new object to the tail
96 else // List is empty
97 m_head = package; // so new object is the head
98
99 m_tail = package; // Either way: the latest object is the (new) tail
100}
101
102bool Truckload::removeBox(SharedBox boxToRemove)
103{

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected