Vijay Kumar
What is the difference between compile time polymorphism and run time polymorphism
By Vijay Kumar in .NET on Sep 09 2014
  • Vijay Kumar
    Sep, 2014 9

    - Compile time Polymorphism Compile time Polymorphism also known as method overloading. Method overloading means having two or more methods with the same name but with different signatures.- Run time Polymorphism Run time Polymorphism also known as method overriding. Method overriding means having two or more methods with the same name , same signature but with different implementation.

    • 2
  • Raghu Kasyap
    Apr, 2015 22

    For compile time polymorphism, the method execution path / method binding happens at the compile time. For run time, it happens at run time, which it provides which method to be called will be decided at run time, eventually the method binding happens at run time. Early binding is implemented using Method over-loading, with same function name having different parameters. Late binding is implemented using method over-riding. Polymorphism is simply, One Interface having many forms. Means that we have a single method that performs / exhibits / behaves differently depending on the situation. Plz refer the Link : https://msdn.microsoft.com/en-us/library/ms173152.aspx

    • 1
  • Arjun Dhilod
    Jul, 2015 3

    Compile time Polymorphism:- public class Class1 { public void NumbersAdd(int a, int b) { Console.WriteLine(a + b); } public void NumbersAdd(int a, int b, int c) { Console.WriteLine(a + b + c); } } Run time Polymorphism:- namespace polymorphism {public class Bclass{public virtual void simple(){Console.WriteLine("Hello Arjun");} }public class CClass :Bclass{public override void simple(){Console.WriteLine("Hi Sanju");}}class Program{static void Main(string[] args){CClass objC = new CClass();objC.simple();Bclass objb = new CClass();objb.simple();Console.ReadLine();}}}

    • 0
  • Munesh Sharma
    Oct, 2014 1

    http://www.aspdotnet-suresh.com/2013/09/compile-time-polymorphism-vs-run-time-polymorphism-in-csharp.html

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS