Make an implementation of A that delegates to B :
class A_Impl : public A { public: virtual void f() { bf(); } private: B b; }
Deploy C by deriving from A_Impl :
class C: public A_Impl { };
Or, if you want to show A in the inheritance hierarchy, publicly publish from A and privately from A_Impl :
class C: public A, private virtual A_Impl { };
Peter Wood
source share