Multiple virtual inheritance ambiguity
<p>Probably best explained with an example:</p>

<pre><code>struct A
{
    virtual void foo() = 0;
};


struct B
{
    virtual void foo() = 0;
};


struct C : A, B
{
    // Implementation of A::foo
    void A::foo();

    // Implementation of B::foo
    void B::foo();
};


// Define here; howto?
</code></pre>

<p>I'm aware I can define the functions inline with the class however that's not feasible in this instance (there are about 6 base classes to implement all with 40+ methods)</p>

<p>--</p>

<p>Apparently I wasn't clear enough. The question directly is: How to define both foo() methods that have been inherited without causing ambiguity issues?</p>

<p>The following does indeed work</p>

<pre><code>void C::foo() { /* etc */ } 
</code></pre>

<p>This will define the implementation of A::foo() yet what of B::foo() ? Bearing in mind I do not wish to define the methods within the declaration of C.</p>

<p>P.S., the reason for modelling the problem this way at all is predefined (COM/OLE)</p>

<p>--</p>

<p>This is fine (MSVC) albeit inline:</p>

<pre><code>struct A { virtual int foo() = 0; };
struct B { virtual int foo() = 0; };

struct C : A, B
{
    int A::foo() { return 1; }
    int B::foo() { return 2; }
};


void main()
{
    C* p = new C();

    cout &lt;&lt; ((A*) p)-&gt;foo();
    cout &lt;&lt; ((B*) p)-&gt;foo();
}
</code></pre>
