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

Method addBox

Examples/Modules/Chapter 12/Ex12_17/Truckload.cpp:66–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.45

Calls 1

setNextMethod · 0.45

Tested by

no test coverage detected