Multiple Inheritance
Stc
Date: 2008-05-22
Time: 12:00
Room: BBL room 471
Speaker: Xiaoyu Cui
Title: Multiple inheritance
Abstract
Inheritance is a key issue in object-oriented programming since it
provides a way to refine common attributes out, enabling inheriting data or
operations defined in one or more classes. For those characteristics of
inheritance, module re-usage in software engineering can be processed
easily. Inheritance can be seen as a relationship between classes where one
class would share data or operations from one or more other classes.
“Without inheritance every class would be a free-standing unit, each
developed from the ground-up. Different classes would bear no relationship
with one another, since the developer of each provides methods in whatever
manner he/she chooses. Any consistency across classes is the result of
discipline on the part of the programmers [1]”. Inheritance makes it
possible to specialize new classes upon pre-defined classes via adding new
features, etc, rather than designing a class from scratch. With
inheritance, it provides a possibility for incremental class building.
Inheritance glues the concepts of classes together, so the changes on
super class will be propagated to all its subclasses.
Classes in inheritance is defined as: the class that inherits features from
others which is called subclass, and the inherited class which is called super-class.
Inheritance is classified into single or multiple inheritance. Single
inheritance restricts that a subclass only can inherit from one super-class, which
forms a tree hierarchy. On the other hand, multiple inheritance allows
that a subclass inherits from more than one super-class which results in an inheritance
graph. Comparing with single inheritance, multiple inheritance provides
better feature sharing which effectively improves modularity,
reusability, and incremental design, etc. As summarized in [2], four
important uses of multiple inheritance are known: Multiple independent
protocols, Mix and match, Sub-modularity and Separation of Interface and
Implementation.
Multiple inheritance brings a powerful and convenient way for software
development. However, it leads to some complexity and ambiguity, therefore the
programming language has to provide mechanisms to solve those problems,
such that conflicts can be resolved. As mentioned in [2], those problems could
be: Name Collision, Repeated Inheritance, Method combination, Difficult to
implement and misuse. This paper give an overview of strategies that
implement multiple inheritance, and compares differences among them.
[1] B. Cox, Object Oriented Programming, an Evolutionary Approach, 1986
[2] G.B.Singh, Single Versus Multiple Inheritance in Object Oriented
Programming, 1995