+ 2
Why function overloading is required in C++ ?
i am confused n eager to know why we require function overloading. ??
3 Respostas
+ 1
Function overloading is a very significant feature of c++. As we've learned that C++ is based on OOPS which has polymorphism feature. Function overloading is actually an example of polymorphism in C++. It is necessary where a single function with different passing arguments is written again and again. It makes a program shorter and easy to understand.
+ 1
Because in C (-like languages) you have to declare the type of the parameters and their number, and sometimes that becomes an issue.
For example you have a function that takes an int for an argument. But now you want the same function for a double or two ints or whatever.
To make this possible, you can (have to) define the function again for the different parameter situation.
+ 1
Probably our two explanations show the standpoint from C ('Look how convenient this is!') and from Python ('Look how combersome it is!') ;)