| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (12 out of 12)

Considerations for Multiple Inheritance

Multiple inheritance directly affects method invocation only when a method executes call next method. Under all other circumstances, G2's use of class inheritance paths filters out any direct effect of multiple inheritance on methods.

G2 uses class inheritance paths to support methods in two different ways:

In either case, only the inheritance path itself matters to G2. The path might result from single inheritance or from linearizing multiple inheritance. G2 scans the path in exactly the same way, regardless of the underlying class hierarchy.

Thus the effect of nested call next method invocations in multiple inheritance can be very complex. This complexity does not result from any special action of G2, which invokes methods in exactly the same way irrespective of the particular class hierarchy. It results from the fact that in multiple inheritance, a class's hierarchy path is not a simple extension of a unique superior class's path, but a linearization of two or more different inheritance paths.

For example, assume that, as shown in the next two figures:

After the KB starts, and after you press each action-button in the order shown, the messages on the Operator Logbook workspace indicate, for each item argument, the order in which each call next method statement caused the method of the next superior class in the class inheritance path to be invoked. The next figure shows the MESSAGE-BOARD workspace after pressing action-buttons 1 and 2, and after pressing buttons 3 and 4.


| Prev | Next | Start of Chapter | Next Chapter | Contents | Glossary | Index | Comments | (12 out of 12)

Copyright © 1997 Gensym Corporation, Inc.