Inheritance/Single: Difference between revisions

m
→‎{{header|PureBasic}}: update with alternative version
(added F#)
m (→‎{{header|PureBasic}}: update with alternative version)
Line 813:
=={{header|PureBasic}}==
Although PureBasic is mostly used for procedural coding it has both the ability to interact with object oriented libraries and code and also the capacity to write it if needed.
===Native version===
 
<lang PureBasic>Interface Animal
Eat()
Line 835:
HeardSheep()
EndInterface</lang>
===Simple OOP Version===
Using the open-source precompiler [http://www.development-lounge.de/viewtopic.php?t=5915 SimpleOOP].
<lang PureBasic>Class Animal
EndClass
 
Class Dog Extends Animal
Public Method Bark()
EndMethod
EndClass
 
Class Cat Extends Animal
Public Method Sleep()
EndMethod
EndClass
 
Class Lab Extends Dog
Public Method Swim()
EndMethod
EndClass
 
Class Collie Extends Dog
Public Method Fetch()
EndMethod
EndClass
 
;- test the code
*Lassie.Collie = NewObject.Collie
*Lassie\Bark()
*Lassie\Fetch()</lang>
 
=={{header|Python}}==
Anonymous user