Difference Between Compile Time And Run Time Polymorphism
Compile-Time Polymorphism |
Run-Time Polymorphism |
---|---|
It is also called Static Polymorphism. | It is also known as Dynamic Polymorphism. |
In compile-time polymorphism, the compiler determines which function or operation to call based on the number, types, and order of arguments. | In run-time polymorphism, the decision of which function to call is determined at runtime based on the actual object type rather than the reference or pointer type. |
Function calls are statically binded. | Function calls are dynamically binded. |
Compile-time Polymorphism can be exhibited by: 1. Function Overloading |
Run-time Polymorphism can be exhibited by Function Overriding. |
Faster execution rate. | Comparatively slower execution rate. |
Inheritance in not involved. | Involves inheritance. |
Difference Between Compile Time And Run Time Polymorphism In C++
In this article, we will discuss the differences between the compile-time and runtime polymorphism in C++.