Question: Help with c++ #include ll.h #include void LinkedList::Link::initialize(unsigned uiData, Link *pNext) { m_uiData = uiData; m_pNext = pNext; } void LinkedList::initialize() { m_pHead = nullptr;
Help with c++

#include "ll.h" #include
void LinkedList::Link::initialize(unsigned uiData, Link *pNext) { m_uiData = uiData; m_pNext = pNext; }
void LinkedList::initialize() { m_pHead = nullptr; // This linked list is empty. }
bool LinkedList::insert(unsigned uiData) { Link* new_link = new Link; // Get a new node.
new_link->initialize(uiData, m_pHead); // Fill it with data. m_pHead = new_link; // Put it at the head.
return true; // Indicate success. }
bool LinkedList::remove(unsigned *pData) { if (!m_pHead) // Empty list? return false; // Indicate failure.
Link *temp = m_pHead; // Point to the first node. m_pHead = m_pHead->m_pNext; // Remove the first node. *pData = temp->m_uiData; // Obtain first nodes data. delete temp; return true; // Indicate success. } ~ "ll.cc" 31L, 850C
. initialize () methods often indicate that the author doesn't understand constructors. Turn them into ctors. Are your ctors using member initialization lists? Make them do so. The method . remove ( ) uses a pointer argument to return a value. C++ programmers prefer reference arguments to pointers. Change the method to use a reference argument, instead. Add a method .print ( ) that displays the list, with one space between each data item, and a newline after the last one. There should not be a space after the last datum. Add another case (4. print) in main () that uses it. Using . print () is tacky. Replace it with an overloaded
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
