Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 877 Bytes

compiler-warning-level-3-c4243.md

File metadata and controls

38 lines (31 loc) · 877 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 3) C4243
Compiler Warning (level 3) C4243
11/04/2016
C4243
C4243
ca72f9ad-ce0b-43a9-a68c-106e1f8b90ef

Compiler Warning (level 3) C4243

'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;
}