C++, diamond inheritance, where/when do pure virtuals need to be implemented? <p>C++: I have a base class A with a pure virtual function f() and then two classes B and C inherit virtually from A, and a class D that inherits from both B and C (the typical diamond structure):</p> <pre><code> A f() = 0 v/ \v B C \ / D </code></pre> <p>Where and when does f() = 0 need to be implemented in the following cases?</p> <ol> <li>Both B and C have also pure virtual functions (-> do abstract classes <em>must</em> implement inherited pure virtuals?)</li> <li>Only one of them (B XOR C) has a pure virtual function (-> does the other still <em>must</em> implement f()?)</li> <li>Neither B nor C have pure virtuals of their own (-> possible way to skip implementation in B and C and "pass it through" to D?)</li> <li>In which of the three above cases does D need to implement f()? In which cases is it optionally for D to implement f()? In which cases, if any, is it not possible for D to implement f()?</li> </ol> <p>Are there any other common suggestions for these kind of problems?</p> <p>Thanks.</p>