Keyword Implements - leonard-thieu/monkey GitHub Wiki
Declares that a class implements the methods of the specified interface.
Syntax
Class Identifier [ Implements Interfaces ] Declarations... End [ Class ]
Description
The Implements keyword is used to declare that a class will provide the methods listed in a given interface.
Please see the Interfaces section of the monkey language reference for more information on interfaces.
See also
Examples
An example of a simple interface, including use of the Implements keyword.
Interface Computer
Method Boot ()
Method Process ()
Method Display ()
End
Class PC Implements Computer
Method Boot ()
Print "BIOS version 1.01. Performing ancient rituals..."
End
Method Process ()
Print "Calculating 1 + 1..."
End
Method Display ()
Print "The result of 1 + 1 equals 2!"
End
End
Class C64 Implements Computer
Method Boot ()
Print "******* COMMODORE 64 BASIC V2 ******* | 64K RAM SYSTEM 38911 BASIC BYTES FREE"
End
Method Process ()
Print "Calculating missile position..."
End
Method Display ()
Print "Enemies exploding!"
End
End
Function Main ()
Print ""
Print "PC"
Print ""
Local ibm:Computer = New PC
ibm.Boot
ibm.Process
ibm.Display
Print ""
Print "C64"
Print ""
Local commodore:Computer = New C64
commodore.Boot
commodore.Process
commodore.Display
End