What is the result of the following program's execution?
#include <iostream>
using namespace std;

void f(double) { cout<<"f1"<<endl; }

void f(const int ) { cout<<"f2"<<endl; }

void f( int & ) { cout<<"f3"<<endl; }

void main(void) { 
    int n = 1;
    double b = 2;
    f(n);
    f(b);
}
Explanation
Compilation error will occur because of an ambiguity. Functions can not be overloaded if description of their parameters differs only by presence of const modifier or reference usage.

Следи за CodeGalaxy

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

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