using System;
class Manager
{
public virtual void Work()
{
Console.WriteLine(“Manager”);
}
}
class Employee : Manager
{
public override void Work()
{
Console.WriteLine(“Employee”);
}
}
class Trainee : Employee
{
public override void Work()
{
Console.WriteLine(“Trainee”);
}
public void Chess()
{
Console.WriteLine(“Playing chess”);
}
}
class Program
{
public static void Main()
{
Manager obj = new Employee(); //Late binding or Run time Polymorphism
Manager obj1 = new Trainee(); //Late binding or Run time Polymorphism
obj.Work(); // Upcasting or Co-variance or R.T.Polymorphism
obj1.Work();// Upcasting or Co-variance or R.T.Polymorphism
((Trainee)obj1).Chess(); // Explicit conversion or Downcasting
}
}