title: Can I override a virtual function with a pure virtual one?
body: <p>I have three classes: <code>B</code>, <code>D</code> and <code>G</code>.  <code>D</code> is a <code>B</code> and <code>G</code> is a <code>D</code>.  Both <code>B</code> and <code>D</code> are abstract.  <code>B</code> is from a third party.</p>
  
  <p><code>B</code> has a non-pure, virtual method that <code>G</code> needs to implement (to be a <code>D</code>).  Can I <strong>and is it good practice to</strong> redefine/override a virtual function to be pure virtual?</p>
  
  <p>Example:</p>
  
  <pre><code>class B // from a third party
  {
  public:
     virtual void foo();
  };
  
  class D : public B
  {
  public:
     void foo() override = 0; // allowed by gcc 4.8.2
     virtual void bar() = 0;
  };
  
  class G : public D
  {
  public:
     // forgot to reimplement foo
     void bar() override;
  };
  
  int main()
  {
     G test;  // compiler error is desired
  }
  </code></pre>
  
  <p>To the question of "can I?" gcc allows it, but I do not have the terms/vocabulary to verify the behavior is part of the standard or is undefined and happens to work today.</p>