title: C++ - Use Class Name As Function Parameter
body: <p>Say I have list of of classes called ItemOne, ItemTwo, ItemThree and ItemFour, which are all subclasses of ItemBase.</p>
  
  <p>I would like to have a constructor in another class called ItemGenerator that accepts the name of any of these classes. How would I do this?</p>
  
  <pre><code>ItemGenerator *someItem = new ItemGenerator(ItemThree);
  </code></pre>
  
  <p>Another option would be to pass a static function on one of these classes, but again, I have no idea how to do that.</p>
  
  <pre><code>ItemGenerator *someItem = new ItemGenerator(ItemOne::start());
  </code></pre>
  
  <p>Thanks.</p>