Which of the following overloaded functions will be called in the main() function?
int main()
{
     f(3.4);
     return 0;
}
Explanation
For the function f(int), the conversion of the actual argument of type double to type int should be applied, which is one of the standard ones. For the function f(double, double), the type of the actual argument double exactly matches the type of the formal parameter. Since exact matching is better than the standard conversion, f(double, double) is considered the most suitable function for this call.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты