This document discusses inheritance in object-oriented programming. It describes how a derived class can access non-private members of its base class. It also outlines the different types of inheritance in C++, including single inheritance, multilevel inheritance, multiple inheritance, hierarchical inheritance, hybrid inheritance, and multipath inheritance.
2. Access Control and Inheritance
• A derived class can access all the non-private
members of its base class.
• Thus base-class members that should not be
accessible to the member functions of derived classes
should be declared private in the base class.
• We can summarize the different access types
according to - who can access them explain in next
slide−
4. Types of Inheritance
• C++ Inheritance Types
• C++ supports six types of inheritance as follows:
• Single Inheritance
• Multilevel Inheritance
• Multiple Inheritance
• Hierarchical Inheritance
• Hybrid Inheritance
• Multipath Inheritance
5. Single Inheritance
• A derived class with only one base class is called single inheritance.
6. Multilevel Inheritance.
• A derived class with one base class and that base class is a derived
class of another is called multilevel inheritance.
10. Multipath Inheritance
• A derived class with two base classes and these two base classes have
one common base class is called multipath inheritance