I have two classes class A and class B. I want class B to have functionality of class A plus some more functionality of its own. One of the very simple ways to do this is to inherit class B from class A. But I cannot do this for some implementation specific reasons.
I have thought of another solution where in I will create another class class C which will contain all the virtual functions. The classes A and B will inherit from class C. The class A will contain the implementation of virtual functions and class B can also define the same set of functions and hence class B will have functionality of class A. Is this the optimal solution? Are there any better solutions than this other than direct inheriting class B from class A?