Multiple Inheritance

BlitzMax Forums/BlitzMax Programming/Multiple Inheritance

Or... an implementation that is similar to a cross between Python and Eiffel would be pretty good...

Type ClassA Inherits ClassB, ClassC
    ...
End Type


By default, name conflicts are resolved in left-to-right order... i.e. on execution, methods on the object are searched first in ClassA, then ClassB and ClassC

Defining aliases and/or wrapping Methods with base calls allows the inheriting object to fine tune the name collisions:
Type ClassA Inherits ClassB, ClassC
    MethodAlias MethodXFromC:ClassC.MethodX
    
    Method MethodX()
        some code here
    End Method

    Method CallABaseMethod()
         ClassB.SomeMethod()
    End Method
    ...
End Type

The above class would have a callable method named "MethodXFromC" which maps to the "MethodX" method of Class C. Since ClassA defines MethodX, the default left-to-right search would give it precedence. The alias would still keep ClassC's version available.

I don't think this implementation would fully eliminate the dangers associated with multiple inheritance on 2 classes that inherit from the same base, but it would minimize it. Especially if aliased methods could hook back several layers deep.