title: Inheritance - Abstract vs. Virtual
body: <p>Let's say I have an <code>Animal</code> class and a <code>Cat</code> class that inherits from <code>Animal</code>. <code>Animal</code> class has a virtual <code>Sleep</code> method and the <code>Cat</code> class overrides that <code>Sleep</code> method.</p>
  
  <pre><code>class Animal
  {
      .....
  
      public virtual void Sleep()
      {
      .....
      }
  }
  
  class Cat: Animal
  {
      .....
  
      public override void Sleep()
      {
      .....
      }
  }
  </code></pre>
  
  <p>If I have a <code>List&lt;Animal&gt; animals</code> variable and add objects of both type <code>Animal</code> and type <code>Cat</code>, when I iterate the list and run the <code>Sleep</code> method, <code>Cat</code> objects will have their own <code>Sleep</code> method run. So far so good.</p>
  
  <p>But in terms of code readability and maintainability, should I rather have an abstract <code>Sleep</code> method somewhere else and have that overridden in both <code>Animal</code> and <code>Cat</code> classes? Because otherwise, for instance when you click "Go To Definition" in VS, it takes you to the <code>Sleep</code> method of the <code>Animal</code> class, which might create a confusion for another developer reading the code. </p>
  
  <p>What is the best practice regarding this?</p>