Function Overloading In C++ | Function Overloading Explained With Real Life Examples | Function Overloading In OOPs
Function Overloading In C++
What is function overloading?
Function overloading means creating duplicates of the same function but it will be different from that function. WHAT ??. I know you don't understand. So let me explain this concept by a real-life example. So think about your mother, your mother is a woman but she plays many roles like sometimes she is your mother, sometimes she plays the role of wife, sometimes she plays the role of daughter, etc. So your mom is overloading to the different roles she overloads different roles every time.
So same function overloading means to overload properties of different functions.
And here is the official definition of function overloading -
Function overloading is a feature in C++ where two or more functions can have the same name but different parameters. When a function name is overloaded with different jobs it is called Function Overloading.
Here in C++ Function overloading mean you overload some other function with the same name but the difference is in the number of parameters and its typing.
Here how you can overload a function in C++ -
Output -
6
370
12.44
Comments
Post a Comment