title: Return one of two possible objects of different types sharing a method
body: <p>I have 2 classes:</p>
  
  <pre><code>public class Articles
  {
      private string name;
  
      public Articles(string name)
      {
          this.name = name;
      }
  
      public void Output()
      {
          Console.WriteLine("The class is: " + this.GetType());
          Console.WriteLine("The name is: " + name);
      }
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public class Questionnaire 
  {
      private string name;
  
      public Questionnaire(string name)
      {
          this.name = name;
      }
  
      public void Output()
      {
          Console.WriteLine("The class is: " + this.GetType());
          Console.WriteLine("The name is: " + name);
      }
  }
  </code></pre>
  
  <p>I want to write a method, that takes an integer (1 meaning <code>Articles</code> should be returned, 2 meaning <code>Questionnaire</code>) and a name. </p>
  
  <p>This method must return an instance of one of those two classes:</p>
  
  <pre><code>public [What type??] Choose(int x, string name)
      {
          if (x == 1)
          {
             Articles art = new Articles(name);
             return art;
          }
          if (x == 2)
          {
              Questionnaire ques = new Questionnaire(name);
              return ques;
          }
      }
  </code></pre>
  
  <p>What return type should I use, so I can call <code>Output()</code> on the result?</p>