Can't call base class's method when another overload present in derived class

后端 未结 1 898
走了就别回头了
走了就别回头了 2021-01-19 04:26

I get a compiler error \"function does not take 0 arguments\" when compiling the following code.

class A
{
public:
    int Foo()
    {
        return 1;
             


        
相关标签:
1条回答
  • 2021-01-19 04:41

    Add this line:

    using A::Foo;
    

    in class B (public part) and it will work.

    In this case Foo from B hides Foo from A. One of the C++ strange behaviors.

    0 讨论(0)
提交回复
热议问题