Compiler Error C2506

'class::identifier' : ambiguous

The specified name referred to more than one class member.

To access a base class or structure, an expression must refer to one unique function, object, type, or enumerator. The scope resolution operator (::) can be used to resolve the ambiguity.

The check for ambiguity is done before access control. A private base class containing only private members has the same potential for ambiguity as a public class.

The following is an example of this error:

class A
{
public:
   int a;
};
class B
{
private:
   int a;
};
class C : public A, private B { };
C c;
int j = c.a;          // error, could be A::a or B::a
int i = c.A::a;       // OK, resolved ambiguity