Saturday, May 9, 2009

Hi.......Can anyone plz help me with the following question.....How do we exactly write a template in C++??

i AM NOT ABLE TO UNDERSTAND HOW TO WRITE A TEMPLATE???PLZ HELP!!!!!!!!!





Write a template class “binary_tree” in C++. The class should have functions for creation of the tree, insertion and deletion of an element, searching a key value in the tree, Post order traversal and output the value in ascending order. Make suitable assumptions, if any.

Hi.......Can anyone plz help me with the following question.....How do we exactly write a template in C++??
template%26lt;class T%26gt; class binary_tree


{


public:


binary_tree()


{


}





void insert(T%26amp; item)


{


}





void delete(T%26amp; item)


{


}


};





Creating the class:





binary_tree%26lt;CString%26gt; myTree;

gift

No comments:

Post a Comment