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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *