I am working on a problem for a class I am taking. We just have to modify the driver some, so I have taken the existing code and copied into my editor/compiler (Bloosshed's DEV C++ 4.9.9.2), and am attempting to compile the exisitng code before making my changes. But I am getting the following error: "\binarySearchTree.h `root' undeclared (first use this function)"
From what I've read, isn't 'root' a special word that the compiler should know? Or is 'root' something that I need to declare somewhere?
Below is a code segment from "binarySearchTree", which is derived of "binaryTree". If additional code would be helpfull, let me know.
Thanks Jsmith! After seeing your reply, I see that *root is declared in the class binaryTree, but wasn't declared in class binarySearchTree. Once I declared it there, it compiled correctly.
Here's another question then. When I was finally able to log into my school's computer, where we are using emacs as our editor/compiler, it compiled just fine, without defining *root in bSerchTree. *root is defined in the base class binaryTree, so I would think (though I'm clearly new to this) that I wouldn't need to define it in the derived class. That thinking bears out using the school's compiler, but not mine.
Should *root need to be declared in both the base and derived classes, or is my compiler just wonkey?
As a side note, after getting it to compile (having defined *root in the derived class) on my machine, the program didn't run anyway. After entering 1 number into the tree, I was getting a Windows error. Am I wrong to think that could be due to the multiple instences of *root?