title: C# explicit casting of derived types
body: <p>If I create class A, and class B inherits from class A, why does C# require me to explicitly cast between them?</p>
  
  <p>For example:</p>
  
  <pre><code>public class Mammal
  {
  }
  
  public class Dog : Mammal
  {
  }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>Mammal foo = new Dog(); // Invalid, wants an explicit cast
  Mammal bar = (Mammal)new Dog(); // This one works
  </code></pre>
  
  <p>I'm just curious what the reasoning is behind that restriction.</p>