class Base{
public:
virtual void func()
{
cout<< "base";
}
};
class Derived : public Base{
private:
void func(){
cout<< "derived";
}
};
int main() {
Base *b = new Derived();
b->func(); //output = "derived"
return 0;
}
When overloading the base function on creation of derived class virtual function , shouldn't vtable also take in the access specifier of the derived class?(for me it seems to be against c++ principles) . Please also explain the decision why the base class access specifier is followed.