title: Virtual inheritance and empty vtable in base class
body: <p>There is this code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Base
  {
     int x;
  };
  
  class Derived : virtual public Base
  {
     int y;
  };
  
  int main()
  {
      std::cout &lt;&lt; sizeof(Derived) &lt;&lt; std::endl; // prints 12
      return 0;   
  }
  </code></pre>
  
  <p>I have read that when some class is virtually inherited then there is created empty vtable for class Derived, so memory layout is as follows:</p>
  
  <pre><code>Derived::ptr to empty vtable
  Derived::y
  Base::x
  </code></pre>
  
  <p>and it is 12 bytes. The question is - what is purpose of this <strong>empty</strong> vtable if there are not any virtual methods and how is it used?</p>