B
This commit is contained in:
parent
e5e8880e41
commit
518da4a923
1019 changed files with 15877 additions and 0 deletions
19
Task/Abstract-type/BBC-BASIC/abstract-type.bbc
Normal file
19
Task/Abstract-type/BBC-BASIC/abstract-type.bbc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
INSTALL @lib$+"CLASSLIB"
|
||||
|
||||
REM Declare a class with no implementation:
|
||||
DIM abstract{method}
|
||||
PROC_class(abstract{})
|
||||
|
||||
REM Inherit from the abstract class:
|
||||
DIM derived{member%}
|
||||
PROC_inherit(derived{}, abstract{})
|
||||
PROC_class(derived{})
|
||||
|
||||
REM Provide an implementation for the derived class:
|
||||
DEF derived.method : PRINT "Hello world!" : ENDPROC
|
||||
|
||||
REM Instantiate the derived class:
|
||||
PROC_new(instance{}, derived{})
|
||||
|
||||
REM Test by calling the method:
|
||||
PROC(instance.method)
|
||||
Loading…
Add table
Add a link
Reference in a new issue