title: Method resolution order in C++
body: <p>Consider the following class hierarchy:</p>
  
  <ul>
  <li>base class Object with a virtual method foo()</li>
  <li>an arbitrary hierarchy with multiple inheritance (virtual and non-virtual); each class is a subtype of Object; some of them override foo(), some don't</li>
  <li>a class X from this hierarchy, not overriding foo()</li>
  </ul>
  
  <p>How to determine which method will be executed upon a call of foo() on an object of class X in C++?</p>
  
  <p>(I'm looking for the algorithm, not any specific case.)</p>