problem in destroying all elements of a binary search tree

why is it giving error ?
[Error] undefined reference to `tree<int>::destroy(node<int>*)'
[Error] collect2: ld returned 1 exit status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 template<class T>
void destroy(node<T> *root) 
{   
    if(root ==0 )
    return;
    else
	{
	
       if(root->left==0  && root->right==0)  
       delete root; 
       delete(root->left);
       delete(root->right);
    
    }  
}



function call:
 
obj.destroy(obj.root);


prototype:
 
void destroy(node<T>*);
1
2
3
4
5
template<class T>
// void destroy(node<T> *root) 
void tree<T>::destroy( node<T>* root ) 
{
    // ... 
Topic archived. No new replies allowed.