Multilevel & Multiple Inheritance
| |||
Multilevel Inheritance The
Compact not only inherits from its immediate
superclass, Car , but also from Car 's superclass,
MotorVehicle . Thus the Compact class also has a
make, a model, a year and so on. There's no limit to this chain of
inheritance, though getting more than four or five classes deep makes code
excessively complex.
Multiple Inheritance Some object oriented languages, notably C++, allow a class to inherit from more than one unrelated class. This is called multiple inheritance and is different from the multi-level inheritance in this section. Most of the things that can be accomplished via multiple inheritance in C++ can be handled by interfaces in Java
| |||
|