My friend ask me some interesting question. Like
What is difference between Early Binding and Compile time polymorphism?
What is difference between Late Binding and Runtime polymorphism?
What is difference between Runtime Polymorphism and Compile time polymorphism?
What is difference between Early Binding and Late Binding?
I am little bit confused so I asked that, Please give me explanation with example..
Thanks in advance..
Loading
Sanjeeb LenkaPosted Oct 8, 2013, 5:08 AM
When a message can be processed in different ways is called polymorphism. Polymorphism means many forms.
Polymorphism is one of the fundamental concepts of OOP.
Polymorphism provides following features:
Polymorphism is of two types:
-
Compile time polymorphism/Overloading/early binding -
Runtime polymorphism/Overriding/Late binding
refer to this link for details:http://www.c-sharpcorner.com/uploadfile/puranindia/polymorphism-in-C-Sharp/
Dharmendra SinghPosted Oct 8, 2013, 4:50 AM
you are saying both are same but have some differences, once that can you explain how can achieve polymorphism without overloading and overridding.
Sanjeeb LenkaPosted Oct 8, 2013, 1:18 AM
It's because function overloads are resolved at the compile time. This is called static or earlier binding(Compiletime Polymorphism)
And virtual methods overrides are resolved at the runtime. This is called dynamic or late binding(Runtime Polymorphism)
Sanjeeb LenkaPosted Oct 8, 2013, 1:16 AM
The name itself describes that compiler knows about what kind of object it is, what are all the methods and properties it contains. As soon as you declared the object, .NET Intellisense will populate its methods and properties on click of the dot button.
Late Binding
The name itself describes that compiler does not know what kind of object it is, what are all the methods and properties it contains. You have to declare it as an object, later you need get the type of the object, methods that are stored in it. Everything will be known at the run time.
Prasenjit DeyPosted Oct 8, 2013, 1:12 AM
http://www.c-sharpcorner.com/interviews/Answer/4037/what-is-difference-between-early-binding-and-late-binding-in