Originally Posted by
Cat
There are a number of other ways:
1. The absolute best way would be to make this a template class. E.g. rather than RBNode, you'd have RBNode<T>, which you'd use as RBNode<Customer>, etc. Here you'd store a T or a T* inside the node.
2. Or, you can make RBNode have a pointer to a class called something like RBData, which is an abstract class with a virtual destructor. Make Book, Customer, etc. derive from RBData.
3. Lastly (though you need to be careful about how you destroy node data) you could fall back to storing a void * inside your tree. That pointer might, in different trees, point to either a Book, or a Customer, etc.