let us suppose some (legacy) code, which cannot be touched, declare
struct B{
public:
void f(){}
};
and let us suppose to have
struct A{
public:
virtual void f()=0;
};
is it possible to make an A subclass call B::f without explicitly calling f(), i.e. instead of
struct C: public A, public B{
void f(){
B::f();
}
};
having something like
struct C:virtual public A,virtual public B{
};
(note that this last class is abstract, for the compiler A::f is not defined)
Directly in C++, it is impossible to dispatch polymorphically based on some implicit matching of B’s functions to A’s. You could resort to some kind of code generation using gccxml or other similar products, but if there’s only a hundred functions a macro can reduce the forwarding to a one-liner anyway – not worth introducing extra tools unless you’ve got thousands and thousands of these to do.