Why is this function not overloaded?? I don't get it
int getValue()
{
int inputValue;
cout << "Enter an integer: ";
cin >> inputValue;
return inputValue;
}
double getValue()
{
double inputValue;
cout << "Enter a floating-point number: ";
cin >> inputValue;
return inputValue;
}
because, to overload the function, functioins must have different signature not only by return value but also by function parameters.
those 2 function can't be overloaded since they are different only by return value.
EIDT:
in your case compiler can't know what type function will return unles it realy returns, because of that compiler don't know which function to call since they are the same.