Declares method as Abstract.
Method Identifier: ReturnType ( Parameters ) [ Property ] [ Abstract
] [ Final ]
Statements...
End [ Method ]
The Abstract keyword declares that a method must be implemented by extending classes. An abstract method also implies that the container class is abstract; this means that objects cannot be created from the resulting abstract class. Objects may only be created from classes that a) extend this class and b) implement the abstract method.
Method | Property
Language reference (Methods)
In this example, Enemy contains an abstract method. This means that objects cannot be created from the Enemy class directly, because there is no specific definition for its Die method; we must first extend the class (see Hoodlum and Alien) and implement the abstract 'Die' method in each extending class.
Class
Enemy
Method
Die
()
Abstract
End
Class
Hoodlum
Extends
Enemy
' Must implement Die method...
Method
Die
()
Print
"B'oss, he-- he killed me, b'oss!"
End
End
Class
Alien
Extends
Enemy
' Must implement Die method...
Method
Die
()
Print
"X'll #hyep, g''ta!! Boss'yap!"
End
End
Function
Main
()
' Not allowed...
' Local e:Enemy = New Enemy
Local
h
:
Hoodlum
=
New
Hoodlum
h.Die
Local
a
:
Alien
=
New
Alien
a.Die
End