title: Delphi - Create class from a string
body: <p>I got code like this</p>
  
  <pre><code>name := 'Foo';
  If name = 'Foo' then
    result := TFoo.Create
  else if name = 'Bar' then 
    result := TBar.Create
  else if name = 'FooFoo' then
    result := TFooFoo.Create;
  </code></pre>
  
  <p>Is there a way just to do </p>
  
  <pre><code>result := $name.create
  </code></pre>
  
  <p>or some way of creating class based of a variable value?</p>
  
  <p>All the classes extended the same base class.</p>