函式過載
當一種型別可以隱式轉換為多種型別並且該特定型別沒有匹配函式時,可能會出現歧義。
例如:
void foo(double, double);
void foo(long, long);
//Call foo with 2 ints
foo(1, 2); //Function call is ambiguous - int can be converted into a double/long at the same time
當一種型別可以隱式轉換為多種型別並且該特定型別沒有匹配函式時,可能會出現歧義。
例如:
void foo(double, double);
void foo(long, long);
//Call foo with 2 ints
foo(1, 2); //Function call is ambiguous - int can be converted into a double/long at the same time