initialize a binary tree within a menu

i have been asked to provide a menu in which we have to initialize upon pressing 1 in a binary search tree... now i know that we cannot initialize the template class object within a conditional statement .. please tell me a way to tackle this problem .

here is my binary tree class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  template<class T>
class node
{
	public:
	T data;
	node<T> *left,*right;
    node()
	{
	  left=right=0;
	}
};

template<class T>
class tree
{
	public:
	node<T> *root;
	tree()
	{
		root=0;
	}
};
	


i need something like this
1
2
3
4
5
if(choice==1)
{
tree<int> obj;
}
Last edited on
Topic archived. No new replies allowed.