how can I derive a tree from two different parent classes in C++?

Hi guys, I’ve been given a task in which my teachers even cannot help me through! I wonder how can I derive a tree from two different parent classes in C++; i.e. which parameters should be from the first and which from the second? I tried putting the left and right pointers in the second and the data in the first, but due to the difference in types, I am not able to use them?
You derive from two different classes when you want to combine two different properties. Although, deriving a tree from two different classes make little sense to me but what you can do is, make two base classes one which gives the functionality of a tree (may be just binary) and the second gives a functionality of lets say BST or always keeping the tree balanced.

Make the base classes abstract so that they give just a framework for others to derive and the methods becomes necessary to be implemented to get the full functionality.

This is more of a designing problem rather than programming.
Last edited on
closed account (1yR4jE8b)
The programming part is easy:

 
class Derived : public Base1, public Base2 {/*insert rest of code here*/};


But writeonsharma is right, it's more of a design issue.
Topic archived. No new replies allowed.