David is getting a compilation error in his program where he has overloaded two functions. One accepts an integer and a float, and the other accepts a float and an integer. He calls the function with two float arguments. What might be the possible reason for the error?

  • Ambiguity
  • Incorrect Syntax
  • Missing Function Declaration
  • Type Mismatch
The compilation error might occur due to ambiguity. When David calls the function with two float arguments, the compiler cannot determine which overloaded function to call because both versions (integer-float and float-integer) are equally valid for the given arguments, resulting in ambiguity.
Add your answer
Loading...

Leave a comment

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