C/C++ Compiler (cl.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
C2506
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     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
                                    -♦-