title: How does virtual inheritance solve the "diamond" (multiple inheritance) ambiguity?
body: <pre><code>class A                     { public: void eat(){ cout&lt;&lt;"A";} }; 
  class B: virtual public A   { public: void eat(){ cout&lt;&lt;"B";} }; 
  class C: virtual public A   { public: void eat(){ cout&lt;&lt;"C";} }; 
  class D: public         B,C { public: void eat(){ cout&lt;&lt;"D";} }; 
  
  int main(){ 
      A *a = new D(); 
      a-&gt;eat(); 
  } 
  </code></pre>
  
  <p>I understand the diamond problem, and above piece of code does not have that problem.</p>
  
  <p>How exactly does virtual inheritance solve the problem?</p>
  
  <p><strong>What I understand:</strong>
  When I say <code>A *a = new D();</code>, the compiler wants to know if an object of type <code>D</code> can be assigned to a pointer of type <code>A</code>, but it has two paths that it can follow, but cannot decide by itself.</p>
  
  <p>So, how does virtual inheritance resolve the issue (help compiler take the decision)?</p>