I have two overloaded methods, both called FunctionX. One of them returns a Boolean object, and one a predefined class called Logs.
The error I’m getting is: The call is ambiguous between the following methods or properties: ‘FunctionX(string)’ and ‘FunctionX(string)’.
In one of my other methods, I call FunctionX(string), expecting the Log object, but it’s throwing this error. I thought the compiler was supposed to look at the return type and figure this out for itself. How can I fix this?
While languages like Perl and Haskell do support overloading by return type, function overloading by return type is not supported by most statically typed languages. So, it is better if you do not make this trivial problem a part of your code.
Added:
You can find more answers in an earlier Stackoverflow discussion here:
Function overloading by return type?