loading
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;

class MainClass {
  public static void Main (string[] args) {
    
    Animal myAnimal = new Animal();
    Animal myDog = new Dog();
    Animal myCat = new Cat();

    myAnimal.sound();
    myDog.sound();
    myCat.sound();

  }
}

public class Animal
{
  public virtual void sound()
  {
    Console.WriteLine("The animal makes a sound");
  }
}

public class Dog : Animal
{
  public override void sound()
  {
    Console.WriteLine("The dog says: bow wow");
  }
}

public class Cat : Animal
{
  public override void sound()
  {
    Console.WriteLine("The cat says: meow");
  }
}