i want to write my own tree class....
which will look like this (stripped down for clearity)
Code:
template <class Object>
class TreeNode
{
public:
Object item;
private:
treenode *ptrBrother;
treenode *ptrSister;
};
template <class Object>
class BinaryTree
{
private:
TreeNode<Object> *ptrRoot;
};
The question is, in tree node, do you think
should just inherit type Object?
if so, would that look like this?
Code:
template<class Object>
class TreeNode : public Object
{
private:
treenode *ptrBrother;
treenode *ptrSister;
};