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
Зареєструйся Зараз
або Підпишись на майбутні тести