| \ examples and tests for objects.fs |
\ examples and tests for objects.fs |
| |
|
| \ written by Anton Ertl 1996, 1997 |
\ written by Anton Ertl 1996-1998 |
| \ public domain |
\ public domain |
| |
|
| cr object heap-new print |
cr object heap-new print |
| |
|
| end-class xcounter |
end-class xcounter |
| |
|
| |
|
| object class |
object class |
| foobar implementation |
foobar implementation |
| |
|
| order |
order |
| cr |
cr |
| |
|
| |
\ test override of inherited interface selector |
| |
xcounter class |
| |
|
| |
m: ( object -- n ) |
| |
this [parent] val 2* |
| |
;m overrides val |
| |
|
| |
end-class ycounter |
| |
|
| |
ycounter dict-new constant z |
| |
cr |
| |
z print cr |
| |
z val . cr |
| |
z inc |
| |
z val . cr |
| |
1 z add |
| |
z val . cr |
| |
|
| |
\ test inst-value |
| object class |
object class |
| foobar implementation |
foobar implementation |
| |
|