class Base{
public:
void callF(){ F(); }
private:
void F(){}
};
class Derived: public Base{
public:
void F(){}
};
int main(){
Derived d;
d.callF();
}
Surprisingly for me,the Base F() is called. I don't understand why. F() was declared and defined in Base class as private,so the Derived object doesn't even know about the existence of such a function in Base. Derived class has its own F(), yet that function is ignored. The question is "Why is the Base class F() called? ".