出错代码:
fun(int x)
{
}
fun(float y)
{
}
void CTest22Dlg::OnButton1()
{
fun(3.0);
}
错误信息:error C2668: 'fun' : ambiguous call to overloaded function
问题分析:编绎系统不知道将3.0转化成浮点形还是整型。
解决方法:
void CTest22Dlg::OnButton1()
{
fun((float)3.0);
}
计算机与编程(It's the Past years, the Log, the Life...)
出错代码:
fun(int x)
{
}
fun(float y)
{
}
void CTest22Dlg::OnButton1()
{
fun(3.0);
}
错误信息:error C2668: 'fun' : ambiguous call to overloaded function
问题分析:编绎系统不知道将3.0转化成浮点形还是整型。
解决方法:
void CTest22Dlg::OnButton1()
{
fun((float)3.0);
}
回复Comments
作者:
{commentrecontent}