title: How to force all derived classes to implement a virtual method?
body: <p>Say you have a base class <code>Dep</code> for a tree of classes. There is a virtual method <code>Dep* Dep::create()</code> that I want to be implemented by every single leaf class. Is there any way to enforce this?</p>
  
  <p>Note: The problem here is that there could be intermediate classes (say <code>class B : public A : public Dep</code>) implementing this method (<code>A::create</code>) by accident or because they <em>think</em> they are leaf classes, but are in fact subclassed themselves.</p>
  
  <p>The question ends here.</p>
  
  <h3>Context</h3>
  
  <p>If you are curious why I need this; I have a class <code>Master</code> which has <code>Dep</code> objects of unknown concrete type. If <code>Master</code> is duplicated, I need to come up with a matching clone of the <code>Dep</code> instance. Next best thing to do is the virtual constructor idiom, which introduces precisely <em>this</em> problem.</p>
  
  <p>Additionally, I cannot even catch this (other then by crashing horribly), because for obscure reasons, people that have more to say than me, have outlawed <code>dynamic_cast</code> in this project (perhaps this is a good decision; But anyways a completely different discussion).</p>