title: Trouble with inheritance: Using pointers with class instantiation not working as expected
body: <p>I'm getting the error <code>undefined reference to 'vtable for Base'</code>. I don't know what this means as I am not using anything called "vtable". Also, I don't exactly understand how making pointers and <code>new Derived</code> are affecting the program. Can anyone clear this up? Thanks.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using std::cout;
  
  class Base { // undefined reference to 'vtable for Base'
  
      public:
          void f();
          virtual void bar();
  
  };
  class Derived : public Base {
      public:
          void f();
          void bar() {
              cout &lt;&lt; "I am bar";
          }
  };
  
  int main() {
  
      Derived d;
      Base * b = &amp;d;
  
      b-&gt;bar();
  
  }
  </code></pre>