Multiple inheritance refers to a feature of some object-oriented programming languages in which a class can inherit behaviors and features from more than one superclass. Object-oriented programming (OOP is a Programming paradigm that uses " objects " and their interactions to design applications and computer programs A programming language is an Artificial language that can be used to write programs which control the behavior of a machine particularly a Computer. In Object-oriented programming, a class is a Programming language construct that is used as a blueprint to create objects This blueprint includes attributes In Object-oriented programming, inheritance is a way to form new classes (instances of which are called objects using classes that have already been defined In Computer science, a superclass is a class from which other classes are derived This contrasts with single inheritance, where a class may inherit from at most one superclass.
Languages that support multiple inheritance include: Eiffel, C++, Python, Perl, Curl, and Common Lisp (via CLOS). Eiffel is an ISO -standardized Object-oriented Programming language designed to enable programmers to efficiently develop extensible reusable reliable C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. Python is a general-purpose High-level programming language. Its design philosophy emphasizes programmer productivity and code readability NOTES FOR EDITORS "Perl" is not an acronym (read the "Name" section below The Curl programming language is a reflective Object-oriented programming language designed for interactive Web content such as Rich Internet applications Common Lisp, commonly abbreviated CL, is a dialect of the Lisp Programming language, published in ANSI standard document Information The Common Lisp Object System (CLOS is the facility for Object-oriented programming which is part of ANSI Common Lisp.
Multiple inheritance allows a class to take on functionality from multiple other classes, such as allowing a class named
StudentMusician to inherit from a class named
Person, a class named
Musician, and a class named
Worker. This can be abbreviated
StudentMusician : Person, Musician, Worker.
Ambiguities arise in multiple inheritance, as in the example above, if for instance the class Musician inherited from Person and Worker and the class Worker inherited from Person. There would then be the following rules:
StudentMusician: Person, Musician, WorkerMusician : Person, WorkerWorker: Person
If a compiler is looking at the class StudentMusician it needs to know whether it should join identical features together, or whether they should be separate features. For instance, it would make sense to join the "Age" features of Person together for StudentMusician. A person's age doesn't change if you consider them a Person, a Worker, or a Musician. It would, however, make sense to separate the feature "Name" in Person and Musician if they use a different stage name than their given name. The options of joining and separating are both valid in their own context and only the programmer knows which option is correct for the class they are designing.
Languages have different ways of dealing with these problems of repeated inheritance.
Java, Nemerle, C#, PHP, and Objective-C do not allow multiple inheritance; this results in no ambiguity. Nemerle is a high-level statically-typed Programming language for the. C# (pronounced C Sharp is a Multi-paradigm PHP is a computer Scripting language. Originally designed for producing Dynamic web pages it has evolved to include a Command line interface capability Objective-C is a reflective, object-oriented Programming language which adds Smalltalk -style messaging to C. However, Java, Nemerle, C# , PHP version 5 and Objective-C allow classes to inherit from multiple interfaces, recreating some of the problems, for example the problem mentioned above. Interface generally refers to an abstraction that an entity provides of itself to the outside
There is debate as to whether multiple inheritance can be implemented simply and without ambiguity. It is often criticized for increased complexity and ambiguity, as well as versioning and maintenance problems it can cause (often summarized as the diamond problem). Programming Complexity, which is often also referred to as Software Complexity is a term that encompasses numerous properties of a piece of software all of which affect In Software engineering, software maintenance is the modification of a software product after delivery to correct faults to improve performance or other attributes or to adapt In Object-oriented Programming languages with Multiple inheritance and knowledge organization the diamond problem is an ambiguity that arises when  Detractors also point out multiple inheritance implementation problems such as not being able to explicitly inherit from multiple classes and the order of inheritance changing class semantics. There are languages that address all technical issues of multiple inheritance, but the main debate remains whether implementing and using multiple inheritance is easier than using single inheritance and software design patterns.
Multiple Inheritance usually corresponds to the is-a relationship. In Knowledge representation and Object-oriented programming and design, is-a is a relationship where one class D is a Subclass It is a common mistake to use multiple inheritance for the has-a relationship. In Database design and Object oriented Program architecture, has-a is a relationship where one object (often called the composited object "belongs" For example, a Filter circuit may consist of Resistors, Capacitors and Inductors. It'll be a mistake to declare Filter as a subclass of resistor, capacitor and inductor (multiple inheritance). Instead, it is better to declare component objects of resistors, capacitors, and inductors within the new Filter class, and reference the component methods indirectly through these component objects.
If the programming language you are using doesn't support multiple inheritance, the is-a relationship can also be implemented as the has-a relationship. Instead of directly inheriting the superclasses (is-a relationship), objects can be declared within the new class to indirectly access the old classes (has-a relationship).