I've something of that nature (simplified)
class A class B class Impl : public A , public B
How do i implement the Function () for any and also the Function() for B ? Visual C++ allows you simply define the particular function inline (i.e. not within the cpp file), however i suppose this is an extension. GCC gripes relating to this. It is possible to standard C++ method to tell the compiler which function I wish to override?
(visual c++ 2008)
class Impl : public A , public B void B::Function ()
You can't use qualified names there. I you are writing
void Function() you're overriding both functions. Plant Sutter shows how it may be solved.
An alternative choice would be to relabel individuals functions, because apparently they are doing different things (otherwise i do not begin to see the problem of overriding both with identical behavior).
Like a workaround, try
struct Impl_A : A struct Impl_B : B struct Impl : Impl_A, Impl_B
If Your and B are connects, i quickly would use virtual derivation to "join" them (make sure they are overlap). If you want different implementations for the
Function if known as via a pointer to
A in order to
B i quickly would highly recommend to select another design. Which will hurt otherwise.
Impl "derives from"
Impl "is really aInch
B. I guess you don't mean it.
Impl "implements interface"
Impl "reacts like"
B. then same interface should mean exactly the same behavior.
In the two cases getting another behavior based on the kind of pointer used could be "schizophrenic" and it is without a doubt a scenario to prevent.