C++ Visibility Modes
Visibility Modes
- Public mode: If we derive a class from a public base class. Then the public member of the parent class will become public in the derived class and protected members of the base class will become protected in derived class.
- Protected mode: If we derive a child-class from a Protected base class. Then both public members and protected members of the base class will become protected in the derived class.
- Private mode: If we derive a subclass from a Private base class. Then both public members and protected members of the base class will become Private in the derived class.
The table below is a simple representation of how the base class members are inherited in each mode of inheritance.
The table below is a simple representation of how the base class members are inherited in each mode of inheritance.