I am stuck on something that I know is so simple that I can't figure it out...
I have a BST class, and a private item:
Node<K> *root; // root pointer
//and in a seperate class I have...
template <typename K>
class Node
{
public:
// constructors
Node() {};
Node(const K newKey, Node<K> *l, Node<K> *r)
:key(newKey), left(l), right(r) {};
// data members
K key; // key is a template
Node<K> * left; // points to left child or NULL
Node<K> * right; // points to right child or NULL
};
//cut&paste some code
Node<K> n;
n.key = newKey;
n.left = NULL;
n.right = NULL;
//so obviously there is a lot of cut&paste going on, but I assure you everything above this line works just fine.
root = &n;
Any help is greatly appreciated!!! After a certain point I tried every combination of &* that I could think of, ie: root = *n; *root=n; *root=&n; *root=*n; ... etc, you get the point!
Any help is greatly appreciated!!!