Listing 2 Defines the node and root classes for a binary tree of dynamically-allocated character arrays

//
// tree.h - tree interface using global classes
//

struct treenode
       {
       treenode(const char *w);
       char *word;
       treenode *left, *right;
       };

class tree
       {
public:
       tree();
       ~tree();
       void add(const char *w);
       void print();
       treenode *root;
       };