OOPs HandbookAccess Specifiers & The Inheritance Visibility Matrix
Language RulesBeginner
6 min read

Access Specifiers & The Inheritance Visibility Matrix

Complete breakdown of private, protected, and public modifiers across derived classes.

TM
TestMeMan SDE Curriculum
Updated Sept 2026
Verified for FAANG Interviews
FROM TESTMEMAN•TestMeMan

Mock tests for SSC, Banking, Railways, UPSC & state exams

Real exam pattern, negative marking and a worked solution for every question.

Sponsored Publisher Placement•
ID: ad-top-leaderboard
Executive Summary

Access specifiers (or access modifiers) govern which parts of an application can read or modify class members. They form the primary boundary of Encapsulation.

1. What Are Access Specifiers?#

• Private: Accessible ONLY within the defining class. Inaccessible to subclasses and external callers.

• Protected: Accessible within the class, by derived subclasses, and within the same package.

• Public: Accessible from any class anywhere in the application.

2. The Official Inheritance Visibility Matrix#

This famous matrix (reproduced directly from Page 5 of the curriculum) defines what happens to base class members under different C++ inheritance modes:

Base Class MemberPublic InheritanceProtected InheritancePrivate Inheritance
Public MemberPublic in derived classProtected in derived classPrivate in derived class
Protected MemberProtected in derived classProtected in derived classPrivate in derived class
Private MemberNot Accessible (Hidden)Not Accessible (Hidden)Not Accessible (Hidden)

The 5 Inheritance Architectures (Visual Topology)

Exact structural blueprints as defined in standard SDE placement examinations.

1. Single Inheritance
Class A (Parent)
Class B (Child)

Direct linear lineage. Exactly one derived class inherits from one base class.

2. Multiple Inheritance
Base A
Base B
Class C (Derived)

One derived class inherits features directly from two or more parent classes.

3. Multilevel Inheritance
Class A (Grandparent)
Class B (Parent)
Class C (Child)

Chained transitive inheritance. Class C inherits from B, which inherits from A.

4. Hierarchical Inheritance
Class A (Single Root)
Child B
Child C
Child D

One parent class serves as the common base for multiple independent child classes.

5. Hybrid Inheritance (Combination)
Class A
Class B
Class C
Class D (Hybrid Child)

Combines hierarchical and multiple inheritance topologies, creating complex polymorphic structures.

Critical Rule

Notice that Private base members are NEVER directly accessible in the derived class, regardless of whether you inherit publicly, privately, or protected! They are always hidden.

Sponsored ContentTestMeMan

Practise placement aptitude on the real test pattern

TCS NQT, Infosys, Wipro, Accenture and Cognizant style mocks with section-wise analysis.

Test Your Concept Mastery

Verify your retention on: Access Specifiers & The Inheritance Visibility Matrix

Diagnostic Check
Question 1 of 1
If a derived class inherits privately from a base class, what access level does a public base member receive in the derived class?
Ready for a full proctored assessment?

Take a free quick test on the real exam pattern, with a worked solution for every question.

Launch Mock Test