An important feature of Inheritance is to know which member of the base class will be acquired by the derived class. This is done by using visibility modes. The accessibility of base class by the derived class is controlled by visibility modes.
The three visibility modes are private, protected and public.
The default visibility mode is private. Though visibility modes and access specifiers look similar, the main difference between them is Access specifiers control the accessibility of the members within the class where as visibility modes control the access of inherited members within the class.
Private visibility mode:
When a base class is inherited with private visibility mode the public and protected members of the base class become ‘private’ members of the derived class
Protected visibility mode:
When a base class is inherited with protected visibility mode the protected and public members of the base class become ‘protected members ‘ of the derived class.
When a base class is inherited with public visibility mode, the protected members of the base class will be inherited as protected members of the derived class and the public members of the base class will be inherited as public members of the derived class.