Programming Previous page   Next Page

Multiple Inheritance

In the multiple inheritance case, a class of objects inherits attributes from more than one parent class. The child object gets fields from all the parent classes, as well as fields of its own.

Multiple inheritance can encompass more than one generation. For example, each of the parent objects could have inherited fields from multiple grandparent objects, and so on. Multiple inheritance is implemented in the constructors by calling class with more than three arguments.

You can append as many parent arguments as desired to the class input list.

Multiple parent classes can have associated methods of the same name. In this case, MATLAB calls the method associated with the parent that appears first in the class function call in the constructor function. There is no way to access subsequent parent function of this name.


Previous page  Simple Inheritance Aggregation Next page

© 1994-2005 The MathWorks, Inc.