How to resolve the algorithm Inheritance/Multiple step by step in the OxygenBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Inheritance/Multiple step by step in the OxygenBasic programming language

Table of Contents

Problem Statement

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.

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.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Inheritance/Multiple step by step in the OxygenBasic programming language

Source code in the oxygenbasic programming language

class Camera
  string cbuf
  method TakePhoto()
  end method
  method ViewPhoto()
  end method
end class

class MobilePhone
  string pbuf
  method MakeCall()
  end method
  method TakeCall()
  end method
end class

class CameraPhone
  has Camera,MobilePhone
end class

CameraPhone cp

cp.ViewPhoto
cp.MakeCall

  

You may also check:How to resolve the algorithm Pentomino tiling step by step in the Racket programming language
You may also check:How to resolve the algorithm Determine if a string is numeric step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Loops/For with a specified step step by step in the SPL programming language
You may also check:How to resolve the algorithm Latin Squares in reduced form step by step in the Go programming language
You may also check:How to resolve the algorithm Strip whitespace from a string/Top and tail step by step in the Action! programming language