Closed theorangepotato closed 8 years ago
The compiler error says that Food* is incompatible with type Food**.
The problem I am having is that I'm not sure why there is a Food\ and where I can go to change that. Any help would be great!
Stack BinaryTree::_inOrderStack(BinaryNode * nodePtr, Stack inOrderStack)
{
if (nodePtr != 0)
{
_inOrderStack(nodePtr->getRightPtr(), inOrderStack);
inOrderStack.push(nodePtr->getItem()); // The problem is here
_inOrderStack(nodePtr->getLeftPtr(), inOrderStack);
}
return inOrderStack;
}
This issue also occurs in main. Please let me know what I can do to fix it.
I know the problem! If you look at the Stack file I wrote, I made it so that it automatically only accepted pointers to its type. So:
Stack
This is my bad. There are two solutions, you declare your stacks as type
It should be fixed now.
Binary node should contain a pointer to Food