Method Overriding:

Method overriding is a feature of inheritance that allows a derived class to provide its own implementation of a method defined in the base class.

The override keyword is used in the derived class to indicate that the method is intended to override the base class method.

Example:

class Shape

{

    public virtual void Draw()

    {

        Console.WriteLine(“Drawing a shape”);

    }

}

class Circle : Shape

{

    public override void Draw()

    {

        Console.WriteLine(“Drawing a circle”);

    }

}

class Rectangle : Shape

{

    public override void Draw()

    {

        Console.WriteLine(“Drawing a rectangle”);

    }

}