$ dotnet run This is VirtualMethodSample(Child Class).
using System; namespace console { class Program { static void Main(string[] args) { VirtualSuperClass VirtualSample = new VirtualChildClass(); VirtualSample.VirtualMethodSample(); } } public class VirtualSuperClass { public virtual void VirtualMethodSample() { Console.WriteLine("This is VirtualMethodSample(Super Class)."); } } public class VirtualChildClass : VirtualSuperClass { public override void VirtualMethodSample() { Console.WriteLine("This is VirtualMethodSample(Child Class)."); } } }