class Base
{
protected:
virtual void show()
{
// Do some stuff.
}
};
class Derived : public Base
{
protected:
virtual void show()
{
// Do some stuff.
}
};
class Derived_2 : public Derived
{
protected:
virtual void show()
{
this->show(); // error: Base::show() is in accessible
show(); // error: Base::show() is in accessible
Derived::show(); // error: Base::show() is in accessible
}
};
In above case calling virtual base class function (overridden in derived classes) gives an error.
The only error I can find, is that you call
show
from itsel leading to infinite recursion and ending in a stack overflow error.But this code compiles and run without even a warning :
(I declared it public to call it directly in my test)