suggest
Multiple inheritance
Now, put vTap to work for you!
Let us keep you up to date with new videos related to:
Multiple inheritance
Go to Feed to see what's new!
+Feed
 
Wikipedia.org
Multiple inheritance (Wikipedia.org)

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. This contrasts with single inheritance, where a class may inherit from only one superclass.

Languages that mostly support multiple inheritance are: Eiffel, C++, Python, Perl, and CLOS (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, Worker Musician : Person, Worker Worker: 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.

  • Eiffel allows the programmer to explicitly join or separate features that are being inherited from superclasses. Eiffel will automatically join features together if they have the same name and implementation. The class writer has the option to rename the inherited features to separate them. Eiffel also allows explicit repeated inheritance such as A: B, B.
  • C++ requires that the programmer state which parent class the feature to use should come from i.e. "Worker::Person.Age". C++ does not support explicit repeated inheritance since there would be no way to qualify which superclass to use.
  • Perl uses the list of classes to inherit from as an ordered list. The compiler uses the first method it finds by depth-first searching the superclass list. Python has the same structure, but unlike Perl includes it in the syntax of the language.
  • CLOS allows full programmer control of method combination, and if that's not enough, the Metaobject Protocol gives the programmer a means to modify the inheritance, method dispatch, class instantiation, and other internal mechanisms without affecting the stability of the system.
  • Logtalk supports both interface and implementation multi-inheritance, allowing the declaration of method aliases that provide both renaming and access to methods that would be masked out by the default conflict resolution mechanism.

Java, Nemerle, C#, PHP, and Objective-C do not allow multiple inheritance; this results in no ambiguity. 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.

more...
Videos
Refine
Kenny Tilton reprises (kind of) the Kennynote Address at European Common Lisp Meeting 2008, a rant on RDF, Lisp GUIs, multiple-inheritance, driving, dataflow, and funtional reactive programming
20m 35s |
a year ago
Google Videos
Keep this video in the "Saved" list
Now, put vTap to work for you!
Let us keep you up to date with new videos related to:
Multiple inheritance
Dataflow
Resource Description Framework
Inheritance (computer science)
Go to Feed to see what's new!
share
keep
 
 
293
Amassing music video by the Israeli "Exhaust", song words by Kafka: "A small child was given by his father a single inheritance, a cat, and for it he became the mayor of London. What shall I become ...
3m 42s |
2 years ago
YouTube
Keep this video in the "Saved" list
Now, put vTap to work for you!
Let us keep you up to date with new videos related to:
Multiple inheritance
Franz Kafka
zvilan (YouTube)
Go to Feed to see what's new!
share
my users
keep
 
 
141
Ellen Van Paesschen
...multiple inheritance), and dynamic parent modification. Further the Self environment includes a powerful mechanism for reflective meta-programming based on mirror objects. The Self group were also ...
41m 37s |
3 years ago
Google Videos
Keep this video in the "Saved" list
Now, put vTap to work for you!
Let us keep you up to date with new videos related to:
Prototype-based programming
Inheritance (computer science)
Object (computer science)
Object-oriented programming
Class (computer science)
Go to Feed to see what's new!
share
my users
keep
 
 
385
- Multiple declarations - Inheritance
6m 30s |
2 years ago
YouTube
Keep this video in the "Saved" list
Now, put vTap to work for you!
Let us keep you up to date with new videos related to:
waynehoggett (YouTube)
Go to Feed to see what's new!
share
my users
keep