Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: viewpoints and multiple inheritance.




Multiple inheritance sounds great from a "conceptual" perspective.  
Unfortunately, it runs into problems as soon as its used for hardened 
semantics.  The C++ standards committee discovered that multiple inheritance 
was a bad idea.  Here's a simple illustration of the problem:

        BC <- Base class

        Class_1 <- inherit/subclass/overload from BC

        Class_2 <- inherit/subclass/overload from BC

        Class 3 <- multiply-inherit from Class_1 and Class_2

Class_3 has all the "methods" (i.e., operations on an object of a specific 
type) from BC, Class_1, and Class_2.  The type of Class_3 is compatible 
(individually) with BC, Class_1, and Class_2.  For example, any "method" 
invoked on objects of type Class_1 can also be invoked on objects of type 
Class_3 (because Class_3 was derived from Class_1).

The problem arises when a "base class" is a "virtual base class" (I'm 
speaking in object-oriented terminology of a particular language, but I'm 
trying to keep the discussion very generic).  A "virtual base class" has no 
real methods, but only realizes its methods once it is derived (inherited).

A polygon is a good illustration of a "virtual base class".  In this 
illustration, a polygon might have methods "calculate_area" and 
"render_image" because every polygon has these features.  However, the 
"calculate_area" method can only be invoked once it is "derived" (via 
inheritance).  If BC is a polygon, Class_1 is a triangle, and Class_2 is a 
square, and Class_3 is multiply inherited from Class_1 and Class_2, then 
what is the meaning of "calculate_area"?  All four classes have different 
meanings of "calculate_area": BC (yet to be specified), Class_1 (triangle), 
Class_2 (square), Class_3 (conflicting definitions).

The notion of multiple inheritance (1) only works well on a small scale, and 
(2) only with base concepts (or classes) from taxonomies that are orthogonal 
(independent).  In other words, our desire for "multiple inheritance" makes 
us dependent on defining orthogonal taxonomies ... which itself is a 
difficult/impossible task.  I suggest that we avoid multiple inheritance 
because the semantics (its meaning, as defined by interoperability 
standards) are very difficult to define.

-FF
-----------------------------------------------------------------------
Frank Farance, Farance Inc.     T: +1 212 486 4700   F: +1 212 759 1605
mailto:frank@farance.com        http://farance.com
Standards, products, services for the Global Information Infrastructure