It\'s easy to understand the virtual function in public inheritance. So what\'s the point for virtual function in private or protected inheritance?
For example:
Both private and protected inheritance allow overriding virtual functions in the private/protected base class and neither claims the derived is a kind-of its base.
Protected inheritance allows derived classes of derived classes to know about the inheritance relationship and still override the virtual functions.
Privately inheriting from the Base
class in your Derived
class, destroys all conceptual ties between the derived and base class. The derived class is just implemented in terms of the base class, nothing more. Private inheritance is just an implementation technique and implies no relationship between the classes involved.