为什么我们在下面的代码中看不到“对重载函数的未定义调用”错误?仅仅因为 int 是内置类型?在标准中的哪里可以找到转换为内置类型的保证,例如在下面的代码中?...谢谢!
#include <iostream>
using namespace std;
class B {
public:
operator int(){ return 0; }
};
class A {
public:
A( int i ) { };
};
void f ( int i ) { cout << "overload f(int) was used!";};
void f ( A a ) { cout << "overload f(A) was used!" ;};
int main () {
B b;
f( b );
}