Why function overloading is called compile time polymorphism? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why function overloading is called compile time polymorphism?

15th Mar 2017, 3:18 PM
Abhishek Satpathy
Abhishek Satpathy - avatar
2 Answers
+ 2
Same function could behave differently depending of parameters (overloads), that's why it is polymorphism. And it is compile time because the right version is chosen during compilation by compiler.
15th Mar 2017, 4:58 PM
soman
+ 1
In function overloading ,as one function behaving differently at different instant of time in a single program so it comes under the polymorphism.As the function body for each function call is chosen in compilation time so it is known as Compiletime polymorphism
17th Mar 2017, 10:59 AM
Manas Mishra
Manas Mishra - avatar