Which one of the following is correct for overloaded functions in $C++$?
According to the overloading‘s definition function the same name with different parameter,
For each overload function complier treat as a new function so option A is correct.
Now See option D
Can two overloaded functions hold the same number of parameters?
Ans is Yes but a different type means example
Option D is Wrong
The correct answer is A
just take a smaal example:-
int sum(int ,int);
float m= sum(x,y);
now my doubt is when i passed x,y to sum ;x,y are of float type but there is no fn def which takes 2 float parameters;
therefore x,y will be degraded to int and int sum will be returned!
so no fn def is there for
but when needed it is degraded to sum(int,int)
hence,shouldn't the option be (B).
The compiler sets up a separate function for every definition of function this is due to overload function in C++. For more information in overloading function. Refer:Function Overloading in C++ So, option (A) is correct.