class B
{
public:
int pubB;
int getPub();
};
class C : private B
{
public:
B::getPub;
int getPub();
int pubC;
};
Is there any way to access the exposed B::getPub function ?
As C has its own getPub, writing
1 2
C oC;
C.getPub();
results in callung the C version of getPub, while
1 2
C oC;
C.B::getPub();
results in an error as the whole B class is private in that context.
I know that I could acces B::getPub() if there was no redefined version of getPub in C class, but I'm wondering if theres anything I could do to access it without changing the classes code ?
Not that way, as you expressed explicit intent to hide that overload of getPub
You can provide another access function which will wrap B::getPub calls.