填空题
下列程序编译时发现pb->f(10);语句出现错误,其原因是 【12】 。
# include<iostream. h>
class Base
{
public:
void f(int x){cout<<"Base:"<<x<<endl;
};
class Derived: public Base
{
public:
void f(char * str){cout<<"Derivcd:"<<str<<endl;}
};
void main(void)
{
Derived * pd=new Derived;
pd->f(10)
}
【参考答案】
数据类型不匹配