so I implemented the definition for a function insertEnd which inserts a linked list node at the end of a linked list. For the most part, it seems to work on its own, but I seem to have issues when using it in other functions (such as concatenating two linked lists) and nothing shows up on the console when it is called so I can't even use a breakpoint to debug
template <class Object>
void List<Object>::insertEnd(const Object& data) // INSERT: At the end!
{
ListNode<Object> *getToEnd = head;
while (getToEnd->getNext() != nullptr)
getToEnd = getToEnd->getNext();
ListNode<Object>* newnode = new ListNode<Object>(data, NULL);
getToEnd->setNext(newnode);
}
EDIT: Here's what I'm trying to use insertEnd with (a function that concactenates)
What I initially did was use a different insert that inserted at the beginning of a linked list, which worked, but that isn't what this new overloaded function is suppose to do (it's suppose to append one list to the back of another), so I created insertEnd to try to use it.