in Education by

What is the difference between late binding and early binding in C#?

1 Answer

0 votes
by
Early Binding and Late Binding concepts belong to polymorphism in C#. Polymorphism is the feature of object-oriented programming that allows a language to use the same name in different forms. For example, a method named Add can add integers, doubles, and decimals.
 
Polymorphism we have 2 different types to achieve that: 
  • Compile Time also known as Early Binding or Overloading.
  • Run Time is also known as Late Binding or Overriding.
Compile Time Polymorphism or Early Binding
 
In Compile time polymorphism or Early Binding, we will use multiple methods with the same name but different types of parameters, or maybe the number of parameters. Because of this, we can perform different-different tasks with the same method name in the same class which is also known as Method overloading.
 
See how we can do that in the following example:
 
ASP.NET 
 
Run Time Polymorphism or Late Binding
 
Run time polymorphism is also known as late binding. In Run Time Polymorphism or Late Binding, we can use the same method names with the same signatures, which means the same type or the same number of parameters, but not in the same class because the compiler doesn’t allow for that at compile time. Therefore, we can use that bind at run time in the derived class when a child class or derived class object will be instantiated. That’s why we call it Late Binding. We have to create my parent class functions as partial and in driver or child class as override functions with the override keyword. 
 
Example
 
ASP.NET 

Related questions

0 votes
    What is the difference between boxing and unboxing in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What is the difference between String and StringBuilder in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What is the difference between Static and Dynamic resources?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
    What is the difference between MVP, MVC and MVVM?...
asked Apr 9, 2021 in Education by JackTerrance
0 votes
    What is the difference between Server.Transfer and Response.redirect?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What is the difference between HttpContext.Current.Items and HttpContext.Current.Session in ASP.NET?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What is the Difference between session and caching?...
asked Apr 7, 2021 in Education by JackTerrance
0 votes
    What is difference between MVC and Web Forms?...
asked Apr 5, 2021 in Education by JackTerrance
0 votes
    What is the difference between WCF and Web services?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    What is Boxing and Unboxing in C#?...
asked Jul 9, 2021 in General by JackTerrance
0 votes
    What is a Hashtable in C#?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    What is Serialization in C#?...
asked Apr 1, 2021 in Education by JackTerrance
0 votes
    What is IEnumerable in C#?...
asked Mar 31, 2021 in Education by JackTerrance
0 votes
    What are sealed classes in C#?...
asked Mar 31, 2021 in Education by JackTerrance
...