P#ifndef BST_H
#define BST_H
#include <string>
usingnamespace std;
//DO I HAVE TO CAPITALIZE ALL 'CONSTANTS' PER THE PROG. ASSIGNMENT EXPECTATIONS?
//DO CLASS OBJECTS HAVE TO BE CAPITALIZED?
class BST
{
public:
BST();
~BST();
void deleteSubtree(Node* curr_root);
void insertContent(const string& word, const string& definition);
void deleteContent(string* word);
const string* getContent(const string& word);
Node* theRoot();
//WHY DOES COMPLILING SAY NODE HAS NOT BEEN DECLARED?
Node* treeMinimum(Node* ptr);
void nodeTransplant(Node* oldN, Node* newN);
private:
class Node
{
public:
Node(Node* cParent, string* word, string* definition)
{parent=cParent; left=NULL; right=NULL; m_word=word; m_definition=definition;}
Node* parent; //IS IT OKAY THAT I ADDED IN A PARENT ATTRIBUTE TO NODES?
Node* left;
Node* right;
string* m_word;
string* m_definition;
};
Node* root;
};
Also, I would like to know how to do the same thing almost, in another class (lines with the Node* in them return errors saying Node has not been declared)
Class Node is
a) Inner class so it can only be accessed from outside the encompassing class as Encompassing::Inner
b) private, so it cannot be accessed from outside the encompassing class at all.
In your case you might fix it by making Node class declaration public and fully qualifying its name in your Dictionary class or by making it stand alone class.