Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
2.1k views
in Object Oriented Programming with C++ by (49.1k points)
closed by

Explain the different visibility mode through pictorial representation.

1 Answer

+1 vote
by (54.8k points)
selected by
 
Best answer

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.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...