void test(int a){} void test(float a){}
test(1);
test(‘c’);
test(2+’d’);
test(0.5);
可参考cppp中文第5版p220,浮点数字面值默认为double,可以转换为int或float,产生二义性错误
void test(int a) { cout << "int" << endl; } void test(float a) { cout << "float" << endl; } int main() { test(0.5); }
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题