public class Animal
{
    public string Name { get; set; }

    public void Speak()
    {
        Console.WriteLine("Animal makes a sound");
    }
}

public class Dog : Animal
{
    public void Speak()
    {
        Console.WriteLine("Dog barks");
    }
}

class Program
{
    static void Main()
    {
        Dog dog = new Dog();
        dog.Name = "Rex";
        dog.Speak(); // خروجی: Dog barks
    }
}