I'm using private inheritance in a project, in the "implemented in terms of"-sense. The base class defines operator[], and this is the functionality I want to use. Thus, I have
class A : private B {
using B::operator[];
// ...
};
However, how can I control which version of the operator[] I get? In fact, I need more than one, both the const
and non-const
versions. Can this be accomplished?
My understanding is that your using
should automatically bring in all the different overloads of the operator. Are there certain overloads you want to exclude from being brought into the child class? In that case it might be better to split the work into several differently named functions in the parent and only using
the ones you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With