class BinarySearchTree
{
public:
BinarySearchTree
(void);
bool addRecursively // calls addRecursive (see private)
(BinarySearchTreeNode* newAdd);
bool addIteratively
(BinarySearchTreeNode* newAdd);
void writeRecursively // calls writeRecursive (see private)
(ostream& outfile) const;
void writeIteratively // if implemented, requires a stack -
(ostream& outfile) const; // - see oop06
private:
void addRecursively
(BinarySearchTreeNode* currentRoot,
BinarySearchTreeNode* newAdd);
void writeRecursively
(ostream& outfile,
BinarySearchTreeNode* currentRoot) const;
protected:
BinarySearchTreeNode* getRoot // provided for descendant classes
(void) const;
private:
BinarySearchTreeNode* root;
};
void writeIteratively (ostream& outfile)
{
ThreadedTreeNode* current = this -> BinarySearchTree::getRoot();// start current at root
ThreadedTreeNode* previous = 0;
.......
Maybe I am missing the obvious but I can not seem to get the root from the inherited binary search tree. I know my professor is wanting me to use the protected method he provided but when I try to use it with this -> or (*this).getRoot.
I get the error i get the invalid use of this in non member function error. Obviously since root (binary search tree) is private I cannot call it directly. Any help would be appreciated.