SEARCH C# PROGRAMMING CODES HERE

Dynamic polymorphism

Dynamic polymorphism in C#
In Dynamic polymorphism, the reaction to a capacity picked at run-time.C# enables you to make unique classes that are utilized to give partial class execution of an interface.
Program

using System;

namespace Dynamic_Polymorphism
{
    public class Light_Bulb     /* Base class*/
    {
        public virtual void Switch()
        {
            Console.WriteLine("Switch_OF");
        }
    }
    public class Connection : Light_Bulb   /* Derived class*/
    {
        public override void Switch()
        {
            Console.WriteLine("Switch_ON");
        }

        }
        class Program
        {
            static void Main(string[] args)
            {
                Light_Bulb open = new Connection();  /* Utilizing functions from Derived class*/
                 open.Switch();
                Light_Bulb close = new Light_Bulb();   /* Utilizing functions from Base class*/
                 close.Switch();
                Console.ReadKey();
            }

        }
    }

Output
Switch_ON
Switch_OF