The main objective of this small article is to provide an introduction about the multiple inheritance subject, give an overview how it is implemented with the Java programming language and my considerations to conclude.
THE INHERITANCE CONCEPT
The concept of inheritance is very close to what we have in genealogy. Fathers share common attributes with sons, whom all share common attributes from its parents, grandparents and so on. Yet, all of them have their own particularities, like eye color, hair color, etc…
Figure 1 Illustration of Genealogy
THE INHERITANCE CONCEPT IN PROGRAMMING LANGUAGES
According to Sklenar, 1997, Simula is known and considered as the first object oriented programming language. This is based on the concept of the conceptualization of the real world brought up to the computing space.
The key aspect of objected oriented programming is to simulate the real world conceptualization of how things are designed, organized and oriented. One of these aspects is the inheritance concept, which is defined and illustrated by Oracle, 2016 as: object-oriented programming allows classes to inherit commonly used state and behavior from other classes. The figure below illustrates the inheritance in a bicycle illustrated analogy:
Figure 2 Illustration of inheritance
The concept of multiple inheritances can be illustrated with genealogy indeed. Father and mother share common aspects with their children the same way grandparents share commons aspects and particularities.
Although multiple inheritances to do not be implemented by some objected oriented programming languages, it is very common to happen in different manners.
IMPLEMENTATION ON THE JAVA PLATFORM
It is widely known that Java does not support multiple inheritance, however Java 8 implements functional interfaces (a resource very similar and that can be compared pretty much the same) which are very similar to the concept of multiple inheritances. There is an example which illustrates its functionality below:
In spite of being a powerful resource to the programmer, it is commonly criticized by its complication to debug and even to lead to unnecessary design complexity. The Java programming language does not support it directly; on the other hand it implements resources (such as function interfaces) which may lead in such manner to achieve the same functional result.
ISOGG Wiki. 2016. Mitochondrial DNA tests. [ONLINE] Available at: http://isogg.org/wiki/Mitochondrial_DNA_tests. [Accessed 20 April 2016].
Sklenar J. 1997. INTRODUCTION TO OOP IN SIMULA. [ONLINE] Available at: http://staff.um.edu.mt/jskl1/talk.html#History_I. [Accessed 20 April 2016].
What Is Inheritance?. 2016. What Is Inheritance? ONLINE] Available at: https://docs.oracle.com/javase/tutorial/java/concepts/inheritance.html. [Accessed 19 April 2016].
Default Methods in Java 8 and Multiple Inheritance. 2016. ProgramCreek.com. [ONLINE] Available at: http://www.programcreek.com/2014/12/default-methods-in-java-8-and-multiple-inheritance/. [Accessed 19 April 2016].