Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 3) C4243

Error Message

'conversion type' conversion exists from 'type1' to 'type2', but is inaccessible

A pointer to a derived class is converted to a pointer to a base class, but the derived class inherits the base class with private or protected access.

The following sample generates C4243:

// C4243.cpp
// compile with: /W3
// C4243 expected
struct B {
   int f() {
      return 0;
   };
};

struct D : private B {};
struct E : public B {};

int main() {
   // Delete the following 2 lines to resolve.
   int (D::* d)() = (int(D::*)()) &B::f; 
   d;

   int (E::* e)() = (int(E::*)()) &B::f; // OK
   e;
}

Community Additions

ADD
Show:
© 2015 Microsoft