Hey hamsterman, that worked well, thanks. I don't know why that thought didn't come to me. Wager I overthought it.
As I predicted, more issues surfaced. Now I've an issue with the divideAt function. For a quick reference as to what it does, I'll paste its explanation from this topic's intro post. Apologies if anyone is annoyed by the repetition:
divideAt() divides a linked list at a set link in the linked list. For example, you input a series of characters for object unorderedLinkedlist<char> list1: j, a, r, c, w, t, q. And here it is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
template <class Type>
void linkedListType<Type>::divideAt(linkedListType<Type> &otherList, const Type &item)
{
nodeType<Type> *current; //node to traverse the list
copyList(otherList); //copies list to otherList
while (first.otherlist->info != item) //while the first is not the one in question
{
current = first.otherList; //assign current to first node in otherlist
first.otherList = first.otherList->next; //first is assigned to next node
count--; //number of items in the list are reduced
delete current; //purges item from list
}
}
|
I know this only accounts for the otherList, and not the original list (so the original list, using the example here would be still be j, a, r, c, w, t, q). But, using the above code, I get this error:
request for member `otherlist' in `((linkedListType<int>*)this)->linkedListType<int>::first', which is of non-class type `nodeType<int>*'
I've never seen this error before, and I don't quite know what to do. Do any of you? Thanks for reading!