Inheritance is a programming technique that enables a class to inherit some or all attributes and behaviors of another class.
Simple inheritance is a type of inheritance in which a class inherits from just one class.
Level inheritance is a type of inheritance in which two or more levels of inheritance exist. Each level consists of a parent-child relationship whereby the child of the middle level is also the parent of the lower level. The last child in level inheritance inherits directly and indirectly from other levels.
Multiple inheritance is a type of inheritance in which a child inherits from multiple parents, but no relationship exists among those parents.
The is a test is given to determine if a child is a parent. For example, is a graduate student a student? If so, the child (graduate student) can inherit from the parent (student). If not, the child cannot inherit from the parent.
Multiple inheritance should be used whenever a child needs to inherit attributes and behaviors from parents that are not related to each other.
Level inheritance should be used whenever a child needs to inherit attributes and behaviors from parents that are related to each other.
There is no maximum number of levels in level inheritance. However, you should use no more than three levels; otherwise , you run the risk that the levels will become unmanageable.
A child can inherit public and protected members of a parent class.
Base class is the term used in C++ to refer to a parent class. Derived class is the C++ term for a child class. A super class is Javas parent class, and Javas child class is called a subclass.