Why is function overloading not possible by changing the return type alone in C++?
- It causes runtime errors
- It creates ambiguity
- It leads to syntax errors
- It's allowed in C++
Function overloading in C++ is based on the number and types of function parameters. Changing only the return type doesn't provide enough information to distinguish between overloaded functions. This would lead to ambiguity, making it impossible to determine which function to call.
Loading...
Related Quiz
- When trying to conserve memory usage, which method of parameter passing might be most effective in certain situations?
- Is it possible to specify default arguments only for some middle arguments in a function, skipping the last ones?
- What is the consequence of having two identical case labels in a switch statement?
- What value does a function with return type void return?
- Kimberly is debugging a program where a loop intended to run 10 times is running indefinitely. Which part of the loop should she particularly inspect for possible logical errors?