title: Create object of unknown class (two inherited classes)
body: <p>I've got the following classes:</p>
  
  <pre><code>class A {
      void commonFunction() = 0;
  }
  
  class Aa: public A {
      //Some stuff...
  }
  
  class Ab: public A {
      //Some stuff...
  }
  </code></pre>
  
  <p>Depending on user input I want to create an object of either Aa or Ab. My imidiate thought was this:</p>
  
  <pre><code>A object;
  if (/*Test*/) {
      Aa object;
  } else {
      Ab object;
  }
  </code></pre>
  
  <p>But the compiler gives me:</p>
  
  <pre><code>error: cannot declare variable ‘object’ to be of abstract type ‘A’
  because the following virtual functions are pure within ‘A’:
  //The functions...
  </code></pre>
  
  <p>Is there a good way to solve this?</p>