Hello friends, in this post today, we learn about what is function overloading in c++. so lets start...
Function overloading:-
Function overloading is the part of compile time polymorphism.
Function overloading refers to creating numbers of functions with the same name which performs different tasks. Function overloading is also known as function polymorphism.
It is accomplish within a class.
The same function name will be used with different number of parameters and parameters of different type.
Overloading of functions with different return types is not allowed.
Compiler identifies which function should be called out of many using the type and number of arguments.
A function is overloaded when same name is given to different functions.
However, the two functions with the same name must differ in at least one of the following,
a) The number of parameters
b) The data type of parameters
Example:-
Output:-
I hope that whatever information I have given in this post today, you have liked it and you have understood it.so keep learning and wait for the next post that will help you to increase your knowledge with something new information .
Thank you so much for reading. And take care about yourself and your family.
Comments
Post a Comment