title: C++ Virtual Inheritance of virtual method
body: <pre><code>struct A {
      virtual void foo() { std::cout &lt;&lt; "a";};
  };
  
  struct B:public virtual A {
      void foo() { std::cout &lt;&lt; "b";}
  };
  
  struct C:public virtual A {
      void foo() { std::cout &lt;&lt; "c";}
  };
  
  struct D:public B, public C {
  
  };
  int main() {
      return 0;
  }
  </code></pre>
  
  <p>So this one while compiling gives us the following error:</p>
  
  <pre><code> \main.cpp:16:8: error: no unique final overrider for 'virtual void A::foo()' in 'D'
   struct D:public B, public C {
  </code></pre>
  
  <p>If we would make the inheritance of B and C structs non-virtual, the code <strong>is compiling</strong> just right without any errors (but of course the error happens if we're calling dd.foo()). So what's the difference? Why do we have an error when we inherit our class virtually and no error if we do it straight?</p>