| 1 |
#include <tads.h> |
| 2 |
|
| 3 |
Book template 'bookName'; |
| 4 |
Watch template 'watchName'; |
| 5 |
Item template 'itemName'; |
| 6 |
object template 'name'; |
| 7 |
|
| 8 |
Book 'book 1'; |
| 9 |
book2: Book 'book2'; |
| 10 |
Watch 'watch 1'; |
| 11 |
watch2: Watch 'watch 2'; |
| 12 |
Stopwatch 'stopwatch 1'; |
| 13 |
stopwatch2: Stopwatch 'stopwatch 2'; |
| 14 |
Item 'item 1'; |
| 15 |
item2: Item 'item 2'; |
| 16 |
Thing 'thing 1'; |
| 17 |
thing2: Thing name='thing 2'; |
| 18 |
|
| 19 |
|
| 20 |
class Book: Item |
| 21 |
sdesc = "bookName = <<bookName>>, itemName = <<itemName>>\n" |
| 22 |
bookName = '(bookName undefined)' |
| 23 |
; |
| 24 |
|
| 25 |
class Watch: Item |
| 26 |
sdesc = "watchName = <<watchName>>, itemName = <<itemName>>\n" |
| 27 |
watchName = '(watchName undefined)' |
| 28 |
; |
| 29 |
|
| 30 |
class Stopwatch: Watch |
| 31 |
sdesc = "stopwatch: <<inherited.sdesc>>" |
| 32 |
; |
| 33 |
|
| 34 |
class Item: object |
| 35 |
sdesc = "itemName = <<itemName>>\n" |
| 36 |
itemName = '(itemName undefined)' |
| 37 |
; |
| 38 |
|
| 39 |
class Thing: object |
| 40 |
name = '(name undefined)' |
| 41 |
; |
| 42 |
|
| 43 |
modify Thing |
| 44 |
sdesc = "name = <<name>>\n" |
| 45 |
; |
| 46 |
|
| 47 |
main(args) |
| 48 |
{ |
| 49 |
for (local obj = firstObj(Thing) ; obj != nil ; obj = nextObj(obj, Thing)) |
| 50 |
obj.sdesc; |
| 51 |
for (local obj = firstObj(Item) ; obj != nil ; obj = nextObj(obj, Item)) |
| 52 |
obj.sdesc; |
| 53 |
} |
| 54 |
|