Inheritance allows to define a new class in erms of another class, In Inheritance super class(base class) properties inherited in to derived class(sub class)
Types of Inheritance: There are different tpes of inheritance as explained below
Sinlge Inheriatance: When there is only one class is inherited from base class There is one class and one derived class.
Multiple-Inheritance : A single derived may inherit from more than one base class.
Hierarchical Inheritance: In this type of inheritance there are multiple derived class(more then one) from base class.
Multilevel Inheritance: In this type of inheritance derived class is inherited from a base class which in turns inherit from other class means there is number of different level of inheritance.
Hybrid(Virtual) Inheritance: Hybrid or Virtual Inheritance is the combination of Hierarchical Inheriatnce and Multilevel Inheriatnce
Diamond Problem: The diamond problem occur when two superclass of a sub class have a comman base class as per above diagram, so Object of most derived class has two copy of class BASE_A ‘s object so there is an ambiguity in derived class which object to use either which is coming through ABD path or which is coming through ACB PATH
400 total views, 2 views today