Compiler Error C2249

'member' : no accessible path to access member declared in virtual base 'class'

The member is inherited from a nonpublic virtual base class or structure.


The following sample generates C2249.

// C2249.cpp
class A {
   void privFunc( void ) {};
   void pubFunc( void ) {};

class B : virtual public A {} b;

int main() {
   b.privFunc();    // C2249, private member of A
   b.pubFunc();    // OK

C2249 can also occur if you try to assign a stream from the Standard C++ Library to another stream. The following sample generates C2249.

// C2249_2.cpp
#include <iostream>
using namespace std;
int main() {
   cout = cerr;   // C2249
   #define cout cerr;   // OK