Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Private inheritance using directive, overloads?

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?

like image 739
carlpett Avatar asked Jan 12 '11 20:01

carlpett


1 Answers

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.

like image 141
Mark B Avatar answered Oct 15 '22 13:10

Mark B