Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Error C2698
Collapse the table of content
Expand the table of content

Compiler Error C2698

the using-declaration for 'declaration 1' cannot co-exist with the existing using-declaration for 'declaration 2'

Once you have a using declaration for a data member, any using declaration in the same scope that uses the same name is not permitted, as only functions can be overloaded.

The following sample generates C2698:

// C2698.cpp
struct A {
   int x;
};

struct B {
   int x;
};

struct C : A, B {
   using A::x;
   using B::x;   // C2698
}
Show:
© 2015 Microsoft