title: C++ How to multiple inherits from interfaces with different return types?
body: <p>Perhaps i have two interfaces with same function names and parameters, but with different return values:</p>
  
  <pre><code>struct A { virtual void foo() = 0; };
  struct B { virtual int foo() = 0; };
  </code></pre>
  
  <p>How to define class C, that inherits this interfaces (if it's of course possible)?
  For example i write some pseudocode that doesn't compiled:</p>
  
  <pre><code>// this code is fake, it doesn't compiled!!
  struct C : A, B
  {
      // how to tell compiler what method using if referenced from C?
      using void foo();  // incorrect in VS 2012
      // and override A::foo() and B::foo()?
      virtual void foo() { std::cout &lt;&lt; "void C::foo();\n"; } // incorrect
      virtual int foo() { std::cout &lt;&lt; "int C::foo();\n"; return 0; } // incorrect
   }
   // ... for use in code
   C c;
   A &amp;a = c;
   B &amp;b = c;
   c.foo();     // call void C::foo() when reference from C instance
   a.foo();     // call void C::foo() when reference from A instance
   b.foo();     // call int C::foo() when reference from B instance
  </code></pre>