title: Delete virtual function from a derived class
body: <p>I have a virtual base class function which should never be used in a particular derived class.  Is there a way to 'delete' it?  I can of course just give it an empty definition but I would rather make its attempted use throw a compile-time error.  The C++11 <code>delete</code> specifier seems like what I would want, but</p>
  
  <pre><code>class B
  {
      virtual void f();
  };
  
  class D : public B
  {
      virtual void f() = delete; //Error
  };
  </code></pre>
  
  <p>won't compile; gcc, at least, explicitly won't let me delete a function that has a non-deleted base version.  Is there another way to get the same functionality?</p>