In this post, I am discussing the difference between compile Time And Runtime Polymorphism.
The meaning of polymorphism stands for “Poly mean Many” + “Morph means Forms”. It is one of the features of object-oriented programming having the ability to take more than one form.
Today we will see, the main two types of polymorphism.
- Compile Time Polymorphism
- Runtime Polymorphism
|Compile-Time Polymorphism||Run-Time Polymorphism|
|It’s also called early binding or static polymorphism.||It’s also called late binding or dynamic binding polymorphism|
|The method is called or invoked during compile time.||The method is called/invoked during run time.|
|The implementation of compile-time via function overloading and operator overloading.||The implementation of Run-Time via function overloading and operator overloading|
|For example, method overloading and operator overloading. Many methods having the same name but different numbers or types of arguments.||For example, method overriding. Many methods having a similar name and the same prototype.|
|Faster execution, because method discovery is done during compile-time.||Slower execution, because method discovery is done during run-time.|
Join Our Community
Join our WhatsApp Group To know more about Programming Language tips, tricks and knowledge about and how to start learning any programming language.