using System;
public class Animal
{
public virtual void MakeSound()
{
Console.WriteLine("The animal makes a sound.");
}
}
public class Dog : Animal
{
public override void MakeSound()
{
Console.WriteLine("The dog barks.");
}
public void Fetch()
{
Console.WriteLine("The dog fetches the ball.");
}
}
public class Cat : Animal
{
public override void MakeSound()
{
Console.WriteLine("The cat meows.");
}
public void Scratch()
{
Console.WriteLine("The cat scratches the furniture.");
}
}
public class Program
{
public static void Main(string[] args)
{
Animal animal1 = new Dog();
animal1.MakeSound();
Animal animal2 = new Cat();
animal2.MakeSound();
Dog dog = new Dog();
dog.Fetch();
Cat cat = new Cat();
cat.Scratch();
}
}