title: Why does calling a method in my derived class call the base class method?
body: <p>Consider this code:</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          Person person = new Teacher();
          person.ShowInfo();
          Console.ReadLine();
      }
  }
  
  public class Person
  {
      public void ShowInfo()
      {
          Console.WriteLine("I am Person");
      }
  }
  public class Teacher : Person
  {
      public new void ShowInfo()
      {
          Console.WriteLine("I am Teacher");
      }
  }
  </code></pre>
  
  <p>When I run this code, the following is outputted:</p>
  
  <blockquote>
    <p>I am Person</p>
  </blockquote>
  
  <p>However, you can see that it is an instance of <code>Teacher</code>, not of <code>Person</code>. Why does the code do that?</p>