Export (0) Print
Expand All
Expand Minimize
0 out of 1 rated this helpful - Rate this topic

Compiler Error C2249

Error Message

'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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.