I'm wondering why a call to a static function is ambiguous, even when one of the two is obviously impossible to call as it is private. I was hoping I could use private / protected inheritance to help the compiler solve the ambiguity.
Is it specific to MSVC or is it somehow specified in the standard ?
struct A
{
static int num() { return 0; }
};
struct B
{
static int num() { return 1; }
};
struct C : public A, private B
{};
int main()
{
C::num(); // Ambiguous access of num
}
The background is that I was trying a way of reusing an overloading behavior (the one in A) in many derived classes (C,D,E,F,G) by inheriting it, to adhere somehow to a rule of Don't Repeat Yourself.