title: understanding vptr in multiple inheritance?
body: <p>I am trying to make sense of the statement in book effective c++. Following is the inheritance diagram for multiple inheritance.</p>
  <p><img src="https://i.stack.imgur.com/Kz90R.png" alt="enter image description here" /></p>
  <p><img src="https://i.stack.imgur.com/OvPhl.png" alt="enter image description here" /></p>
  <p>Now the book says separate memory in each class is required for vptr.  Also it makes following statement</p>
  <p><em><strong>An oddity in the above diagram is that there are only three vptrs even though four classes are involved.</strong> Implementations are free to generate four vptrs if they like, but three suffice (it turns out that B and D can share a vptr), and most implementations take advantage of this opportunity to reduce the compiler-generated overhead.</em></p>
  <p>I could not see any reason why there is requirement of separate memory in each class for vptr. I had an understanding that vptr is inherited from base class whatever may be the inheritance type. If we assume that it shown resultant memory structure with inherited vptr  how can they make the statement that</p>
  <blockquote>
  <p>B and D can share a vptr</p>
  </blockquote>
  <p>Can somebody please clarify a bit about vptr in multiple inheritance?</p>
  <ul>
  <li>Do we need separate vptr in each class ?</li>
  <li>Also if above is true why B and D can share vptr ?</li>
  </ul>