这是一个非常基本的问题,但我的C++技能有点生疏...重载函数
我有了一个成员函数,有3个参数,如基类:
class MyBaseClass
{
public:
int func(int a, char b, int c);
};
和重载用1参数版本该功能的派生类,例如:
class MyDerivedClass : public MyBaseClass
{
public:
int func(float a);
};
当我尝试调用从基类的功能的派生类的对象上, 喜欢这个:
MyDerivedClass d;
d.func(1, 'a', 0);
编译器抱怨说MyDerivedClass::func() does not take 3 arguments
。这是真的,但我不应该通过派生类的对象访问基类函数吗?
我在做什么错?
看到这个主题? http://stackoverflow.com/questions/1896830/why-should-i-use-the-using-keyword-to-access-my-base-class-method – taocp