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

Method addBox

Examples/Modules/Chapter 12/Ex12_18/Truckload.cpp:65–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected