answersLogoWhite

0

Type of inheritances in c plus plus?

User Avatar

Anonymous

11y ago
Updated: 8/18/2019

Single, multiple, multi-level, hierarchical and hybrid/virtual inheritance.

Single inheritance applies when one class inherits from just one base class.

Multiple inheritance applies when one class inherits from two or more base classes.

Multi-level inheritance applies to a class that inherits from at least one base class that is itself derived from another base class.

Hierarchical inheritance applies to a base class that is inherited by two or more separate derived classes.

Hybrid inheritance combines multiple inheritance, multi-level inheritance and hierarchical inheritance. That is, where A is a common base class of derived classes B and C, and B and C are both base classes of derived class D. Hybrid inheritance is often used with virtual inheritance where B and C inherit from A virtually rather than directly. In these cases, the virtual base class is instantiated by the most-derived class in the hierarchy, D, and this instance is then shared by both B and C.

User Avatar

Wiki User

11y ago

What else can I help you with?