Edit

Share via


Compiler Error C2886

'class::identifier' : symbol cannot be used in a member using-declaration

A using declaration uses a symbol, such as a namespace name. A using declaration is for declaring base class members.

The following sample generates C2886:

// C2886.cpp
// compile with: /c
namespace Z {
    int i;
}

class B {
protected:
    int i;
};

class D : public B {
    // Error: Z is a namespace
    using Z::i;   // C2886

    // OK: B is a base class
    using B::i;
};