I've a problem, i've those class, that now works, because i've the attribute in public, but if i put it in private, or protected and inherited to the second class, it's not work, how can i do it? I need to respect OOP rules
template <typename T>
class BinaryNode
{
public:
T key;
BinaryNode<T>* left;
BinaryNode<T>* right;
BinaryNode<T>* parent;
BinaryNode(){}
~BinaryNode(){}
};
And this:
template <typename T>
class BinarySearchTree
{
private:
BinaryNode<T>* root;
BinaryNode<T>* newNode(T key);
BinaryNode<T>* minimum(BinaryNode<T>* node);
BinaryNode<T>* maximum(BinaryNode<T>* node);
BinaryNode<T>* successor(BinaryNode<T>* node);
void insert(BinaryNode<T>** node, T key);
BinaryNode<T>* search(BinaryNode<T>* node, T key);
void distance(BinaryNode<T>* node, T key);
void inorderTreeWalk(BinaryNode<T>* node);
public:
BinarySearchTree();
~BinarySearchTree();
void insert(T key);
BinaryNode<T>* search(T key);
void distance(T key);
void inorderTreeWalk();
BinaryNode<T>* remove(BinaryNode<T>* node);
};
There's the header file: https://www.dropbox.com/s/s8xsn3q01ysyy4f/classi.h
Can you show me how i can do? Thanks, Bye