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