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.




 
# Project : Inheritance/Multiple
 
mergemethods(:CameraPhone,:MobilePhone)
 
o1 = new CameraPhone 
? o1
? o1.testCamera()
? o1.testMobilePhone()
 
func AddParentClassAttributes oObject,cClass
    # Add Attributes 
        cCode = "oTempObject = new " + cClass 
        eval(cCode)
        for cAttribute in Attributes(oTempObject)
            AddAttribute(oObject,cAttribute)
            cCode = "oObject." + cAttribute + " = oTempObject." + cAttribute
            eval(cCode)
        next 
 
 
class Camera
    Name = "Camera"
    func testCamera
        ? "Message from testCamera"
 
class MobilePhone
    Type = "Android"
    func testMobilePhone 
        ? "Message from MobilePhone"
 
class CameraPhone from Camera 
 
    # Add MobilePhone Attributes 
        AddParentClassAttributes(self,:MobilePhone)
 