Multiple inheritance allows to specify that one  class is a subclass of several other classes.

Some languages allow multiple inheritance for arbitrary classes,   others restrict it to interfaces,   some don't allow it at all.



Task

Write two classes (or interfaces) Camera and MobilePhone,   then write a class CameraPhone which is both a Camera and a MobilePhone.

There is no need to implement any functions for those classes.




def minherit(self, supers) {
    def forwarder match [verb, args] {
        escape __return {
            if (verb == "__respondsTo") {
                def [verb, arity] := args
                for super ? (super.__respondsTo(verb, arity)) in supers {
                    return true
                }
                return false
            } else if (verb == "__getAllegedType") {
                # XXX not a complete implementation
                return supers[0].__getAllegedType()
            } else {
                def arity := args.size()
                for super ? (super.__respondsTo(verb, arity)) in supers {
                    return E.call(super, verb, args)
                }
                throw(`No parent of $self responds to $verb/$arity`)
            }
        }
    }
    return forwarder
}