using System;
class Parent
{
public virtual void Display() { // Virtual function
Console.WriteLine("This is the Parent class.");
}
}
class Child : Parent
{
public override void Display() { // Overriding the virtual function
Console.WriteLine("This is the Child class.");
}
}
class Program
{
static void Main(string[] args)
{
Parent obj = new Child();
obj.Display(); // Calls the Child Display method at runtime
}
}
/*
run:
This is the Child class.
*/