|
-
August 20th, 2007, 01:53 PM
#1
pointer type for templated node class
I am trying to make a robust Node<K,D> class, where K is the key type, and D is the datatype. I don't know what to do for the child pointers.
I would like to be able to do this:
Node<int,char> node_one(1,'n');
Node<char,bool> node_two('m',true);
and then set a node_one.children[LEFT] pointer to the address of node_two. However, if I declare the children pointer as:
Node<K,D>* children[2];
then node_one's pointers can only point to Node<int,char> objects, whereas I want to point to a Node<char,bool> object, node_two.
What to do?
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|