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
2. Operator 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++.

Similar Reads

What is Polymorphism?

Poly means many and morph means forms or shape. Thus the word Polymorphism comes from Greek and it basically means having many forms....

Compile Time Polymorphism in C++

In compile-time polymorphism, the compiler determines which function or operation to call based on the number, types, and order of arguments. It is also called Static Polymorphism as the function calls are statically binded to its definition....

Run Time Polymorphism

...

Difference Between Compile Time And Run Time Polymorphism

...