brandon-a / CIS-22C-Group-Project

Using different data structures to organize USDA nutritional facts.
0 stars 0 forks source link

Binary node should contain a pointer to Food #11

Closed theorangepotato closed 8 years ago

theorangepotato commented 8 years ago

Binary node should contain a pointer to Food

brandon-a commented 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.

theorangepotato commented 8 years ago

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 a; a.push(*Food);

This is my bad. There are two solutions, you declare your stacks as type , not <Food *>, or I change stack. I think the best option is for me to change stack. I will get on that.

theorangepotato commented 8 years ago

It should be fixed now.