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.




/* NetRexx */
options replace format comments java crossref symbols binary
 
class RInheritMultiple public
  method main(args = String[]) public static
    iPhone = RInheritMultiple_CameraPhone()
    if iPhone <= RInheritMultiple_Camera then -
      say -
      'Object' hashToString(iPhone) '['iPhone.getClass().getSimpleName()']' -
      'is a' RInheritMultiple_Camera.class.getSimpleName()
    if iPhone <= RInheritMultiple_MobilePhone then -
      say -
      'Object' hashToString(iPhone) '['iPhone.getClass().getSimpleName()']' -
      'is a' RInheritMultiple_MobilePhone.class.getSimpleName()
    say iPhone.snap()
    say iPhone.call()
    return
  method hashToString(that = Object) public static
    return '@'(Rexx that.hashCode()).d2x().right(8, 0)
 
class RInheritMultiple_Camera private interface
  -- properties follow...
  shutter = 'click...'
  -- method prototypes follow
  method snap() public returns Rexx
 
class RInheritMultiple_MobilePhone private interface
  -- properties follow...
  ringTone = 'ring...'
  -- method prototypes follow
  method call() public returns Rexx
 
class RInheritMultiple_CameraPhone private -
  implements -
    RInheritMultiple_Camera, -
    RInheritMultiple_MobilePhone -
  uses -
    RInheritMultiple_Camera, -
    RInheritMultiple_MobilePhone
  method RInheritMultiple_CameraPhone() public
    return
  -- method implementations follow 
  method snap() public
    return shutter
  method call() public
    return ringTone