I have a problem with a function that outputs a binary tree as an "inorder string". I've used such a function before so I know the logic of it is right, but now I am accessing the "Nodes" in the tree from a separate class altogether and somehow get an error from that.
Here's the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
string BST::inorder()
{
return inorder(root);
}
string BST::inorder(Node* n)
{
stringstream out;
if (n != NULL)
{
out << inorder(n->getLeftChild); //Error C3867 here
out << n->getData; //Error C3867 here
out << inorder(n->getRightChild); //Error C3867 here
}
return out.str();
}
Here is the Node class, which is separate from the BST class:
I have all the include statements right and stuff, but the debugger tells me I have an error because "Node::getLeftChild': non-standard syntax; use '&' to create a pointer to member".