RAD Studio
ContentsIndex
PreviousUpNext
E2247: 'member' is not accessible

You are trying to reference C++ class member 'member,' but it is private or protected and can't be referenced from this function. 

This sometimes happens when you attempt to call one accessible overloaded member function (or constructor), but the arguments match an inaccessible function. 

The check for overload resolution is always made before checking for accessibility. 

If this is the problem, try an explicit cast of one or more parameters to select the desired accessible function. 

Virtual base class constructors must be accessible within the scope of the most derived class. This is because C++ always constructs virtual base classes first, no matter how far down the hierarchy they are. For example:

class A {
public:
   A();
};
class B : private virtual A {};
class C : private B {
public:
C();
};
C::C() {} // error, A::A() is not accessible

Since A is private to B, which is private to C, it makes A's constructor not accessible to C. However, the constructor for C must be able to call the constructors for its virtual base class, A. If B inherits A publicly, the above example would compile.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!