title: Casting children classes dynamically
body: <p>I have the following classes:</p>
  
  <pre><code>class Base{
  public:
      virtual int do_Something();
  };
  
  class ChildA : public Base {
  public:
      int do_Something();    // ChildA does something
  };
  
  class ChildB : public Base {
  public:
      int do_Something();    // ChildB does something
  };
  </code></pre>
  
  <p>In my main.cpp I want to create an object <code>ChildA()</code> or <code>ChildB()</code> based on a specific configuration that the user sets.
  My attempt, inside a function <code>main()</code> is:</p>
  
  <pre><code>...
  int config = 1; // selected by the user
  
  Base* classe;
  std::cout&lt;&lt;typeid(classe).name() &lt;&lt; std::endl;     // check class name
  if (config==0){
      classe= new ChildA();
  }
  else if (config==1){
      classe= new ChildB();
      std::cout&lt;&lt;typeid(classe).name() &lt;&lt; std::endl;     // check class name
  }
  ...
  </code></pre>
  
  <h1>Problem</h1>
  
  <p>I expect the printed names to be different. Instead, the output is:</p>
  
  <pre><code>P4Base
  
  P4Base
  </code></pre>