中国开发网: 论坛: 程序员情感CBD: 贴子 492053
老玉米
看样子确实是这样.不过还是很confused...
[root@tivc32 tmp]# cat test.cpp
struct A {
virtual void f(){}
};
struct B: public A {
void f(int){}
};

int main(){
B *b = new B;
b->f();
return 0;
}
[root@tivc32 tmp]# g++ test.cpp
test.cpp: In function `int main()':
test.cpp:10: no matching function for call to `B::f()'
test.cpp:5: candidates are: void B::f(int)

把B::f(int)注释掉就可以..

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录