c++ issue with function overloading in an inherited class

All you need is a using:

class classB:public classA{ 
    public:
        using classA::func;
        void func(int){};
};

It doesn’t search the base class for func because it already found one in the derived class. The using statement brings the other overload into the same scope so that it can participate in overload resolution.

Leave a Comment