title: Create object of type specified in a given char
body: <p>My header file defines multiple classes with single character names; i.e class A, class B, class C etc. each class supports .getname() which returns the class name as a char, given a randomly generated char I'm am challenged with using a template to return the size using sizeof().</p>
  <p>I'm so far unable to figure out how to define the class type given a char value.</p>
  <p>my hope is to allow the following to print the size of the A class, for simplification purposes I've assigned testChar to 'A', however in reality it could be any random char for which a matching class name exists;</p>
  <pre><code>class A
  {
  private:
      char name;
  
  public:
      A(){name='A';}
      char getName(){return name;}
  };
  
  template &lt;typename X&gt;
  void printSize()
  {
      X newObject;
      std::cout&lt;&lt;sizeof(newObject)&lt;&lt;std::endl;
  }
  int main()
  {
      char testChar = 'A';
      printSize&lt;testChar&gt;();
      return 0;
  };
  </code></pre>
  <p>and help would be greatly appreciated!</p>
  <p>edit: I should have also mentioned that the random char given could be any char value and the class types are not meant to be explicitly referenced using switch cases or if else statements.</p>