The answer is:
The definition of the Title is simple and self explanatory. BTW all this info is from: http://en.wikipedia.org/wiki/Multiple_inheritance.
Languages that support multiple inheritance include: Eiffel, C++, Dylan, Python, Perl, Perl 6, Curl, Common Lisp (via CLOS), OCaml, Tcl (via Incremental Tcl)[1], and Object REXX (via the use of mixin classes).
Diamond problem:
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 PersonC++ 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 (see criticisms). C++ also allows a single instance of the multiple class to be created via the virtual inheritance mechanism (i.e. "Worker::Person" and "Musician::Person" will reference the same object).
No comments:
Post a Comment