Inheritance/Multiple: Difference between revisions

no edit summary
(implement a demonstrative program in nim lang in the light of lack of multiple inheritance)
No edit summary
Line 488:
' other stuff
End Type</lang>
 
=={{header|Forth}}==
 
Standard Forth does not supply high level data structures
or functions. But there is library code written by vendors
or users. For object programming with multiple inheritance
there is a user-supplied ANS compatible extension.
 
https://github.com/DouglasBHoffman/FMS2
Download the FMSMI package to run the
following example code.
 
<lang forth>
 
\ define class camera with method say:
:class camera
:m say: ." camera " ;m
;class
 
\ define class phone with method say:
:class phone
:m say: ." phone " ;m
;class
 
\ define cameraPhone phone with method say:
\ class cameraPhone inherits from both class
\ camera and class phone
:class cameraPhone super{ camera phone }
:m say: self say: \ method conflicts in superclasses
\ are resolved by left-to-right order
\ so self say: will call the say: method
\ from class camera
super> phone say: \ super> phone is used to direct
\ this say: method to use the
\ method from class phone
;m
;class
 
cameraPhone cp \ instantiate a cameraPhone object named cp
 
cp say: \ send the say: message to cp
 
\ output:
camera phone
</lang>
 
=={{header|Go}}==