Inheritance: The mechanism of deriving new class from an old (existing) class is called as inheritance. With inheritance, one class acquires the properties of objects of other classes.
Following are different visibility modes in C++:-
1. Public 2. Private 3. Protected
Private members of base class are not inherited directly in any visibility mode.
1. Private visibility mode: - In this mode, protected and public members of base class becomes private members of derived class.
2. Protected visibility mode: - In this mode, protected and public members of base class become protected members of derived class.
3. Public visibility mode:-In this mode, protected members of base class becomes protected members of derived class and public members of base class becomes public members of derived class.