title: Getting "source type is not polymorphic" when trying to use dynamic_cast
body: <pre><code>struct A {};
  
  struct B : A {};
  
  int main()
  {
      A* a = new B();
  
      B* b = dynamic_cast&lt;B*&gt;(a);
  }
  </code></pre>
  
  <p>gives:</p>
  
  <blockquote>
    <p><a href="https://ideone.com/wxHBB3" rel="noreferrer">cannot dynamic_cast 'a' (of type 'struct A*') to type 'struct B*' (source type is not polymorphic)</a></p>
  </blockquote>
  
  <p>How can I make <code>A</code> polymorphic?  I want to safely cast it to B.</p>
  
  <p>(One way is to add a dummy virtual function, but is there a better way?)</p>