title: Object layout in case of virtual functions and multiple inheritance
body: <p>I was recently asked in an interview about object layout with virtual functions and multiple inheritance involved.<br>
  I explained it in context of how it is implemented without multiple inheritance involved (i.e. how the compiler generated the virtual table, insert a secret pointer to the virtual table in each object and so on).<br>
  It seemed to me that there was something missing in my explanation.<br>
  So here are questions (see example below)  </p>
  
  <ol>
  <li>What is the exact memory layout of the object of class C.  </li>
  <li>Virtual tables entries for class C.</li>
  <li>Sizes (as returned by sizeof) of object of classes A, B and C. (8, 8, 16 ?? )</li>
  <li>What if virtual inheritance is used. Surely the sizes and virtual table entries should be affected ?    </li>
  </ol>
  
  <p>Example code:</p>
  
  <pre><code>class A {  
    public:   
      virtual int funA();     
    private:  
      int a;  
  };
  
  class B {  
    public:  
      virtual int funB();  
    private:  
      int b;  
  };  
  
  class C : public A, public B {  
    private:  
      int c;  
  };   
  </code></pre>
  
  <p>Thanks!</p>