0

With 'using declarations' I can introduce a base class member into definition of my class:

class Base {
    public:
    void baseMemberFn();
    /* ... */
};

class Derived : private Base {
    public:
    using Base::baseMemberFn;
};

However, in my case, I want to only 'use' one specific overload of the member from the base class. Is there a syntax to do so?

1 Answer 1

3

There's no syntax for that.

Make a new member function with the same name, that forwards the call to the parent:

void baseMemberFn() {Base::baseMemberFn();}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.