title: Accessing class fields using a variable set to that class
body: <p>I have a situation in which I have a class called <code>myClasses</code> and two sub classes called <code>subOne</code> and <code>subTwo</code>.</p>
  
  <pre><code>class myClasses
  {
      class subOne 
      {
         public const SOfieldOne = "blahblah";
         public const SOfieldTwo = "blahblahblah";
      }
  
      class subTwo 
      {
         public const STfieldOne = "blahblah";
      }
  }
  </code></pre>
  
  <p>I want to be able to set a variable to either class <code>subOne</code> or <code>subTwo</code> based on an argument passed to one of my methods. I then want to be able to access the members within <code>subOne</code> or <code>subTwo</code> using this general variable.</p>
  
  <p>For example if the argument is "useSubOne" I want to set a variable <code>subToUse</code> as so...</p>
  
  <pre><code>subToUse = myClasses.subOne;
  </code></pre>
  
  <p>I should then be able to access <code>SOfieldOne</code> by typing the following...</p>
  
  <pre><code>subToUse.SOfieldOne
  </code></pre>
  
  <p>How would I go about doing this?</p>