defining struct node pointer in main

Hey guys i need help on how to define a node pointer in main.
here is my .h file (tree.h)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <string>
#include <sstream>
#include <iostream>


using namespace std;

template <typename itemtype>

class tree
{
private:
	struct node 
	{
		itemtype data;
		node* left;
		node* right;
		int height;
	}; 

	node* root;
	int size;

public:
	tree();
	//~tree();
	void add(itemtype, node* &);
	void remove(itemtype,node* &);
	void find(itemtype, node* &);
	void print();
	void clear(node* &);

	int treeheight(node* &);
};



and here is my main.cpp

1
2
3
4
5
6
7
8
9
10
11
12

int main (int argc, char* argv[])
{
        tree <int> a;
        node* root; // ---- this is where it says ("argument list for class template node is missing")


	

	system ("pause");
	return 0;
}


i cant figure out how to define it. thanks guys!
Last edited on
Node is private class of tree, so only tree can use it.
where should i define it or what should i add in order to be able to call it in main?
Outside the tree class. Or you could define it in public section, but then you'd have to call it like tree<int>::node.
Topic archived. No new replies allowed.