Inheritance Basics - Adding the Dog class

In this article we'll:

  • Create a specific Dog class that inherits from the Animal base class.
  • Add the Dog specific method WatchHouse to the dog class.

Dog class :

using System.Windows.Forms;
namespace Northwind.Training
{
    class Dog:Animal
    {
        public void WatchHouse()
        {
            MessageBox.Show("Watching carefully");
        }
    }
} 

replace Animal by Dog class :

public void Run()
{
-    var a = new Animal();
     var a = new Dog();
     a.WatchHouse();
} 


Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com