// TNode.h - word consists of a generic node with 2 pointers // data is of type T // left is pointing to preceeding TNode // right is pointing to succeeding TNode // An object of this class is contained in Encoder's dll #ifndef TNODE_CLASS #define TNODE_CLASS template class TNode { private: T word; TNode *left; TNode *right; public: // default constructor // initializes all data members to default values TNode(); // constructor with string // other data members are set to default values TNode(T); // destructor virtual ~TNode(); // constructor with data members set to // s, l and r, respectively TNode(T s, TNode *l, TNode *r); // accessor for word // returns the string // need to define it this way in order to use iterators const T & getWord() const; // accessor for word // non-const version of getWord() T & getWord(); // returns pointer to (address of) node left points to TNode * getLeft() const; // returns pointer to (address of) node right points to TNode * getRight() const; // mutator - changes value of left to x void setLeft(TNode * x); // mutator - changes value of right to y void setRight(TNode * y); // mutator - changes the value of word void setWord(T); // for the purpose of testing TNode class // writes the contents of a single TNode void writer(); private: // you may put any other private methods here }; #endif // TNODE_CLASS