EuroTcl 2023
- Jim and Tcl interoperability, Featuring thing o_o, Georg Lehner, 2023-07-20
thing
Factories
package require Tcl
lappend auto_path .
package require thing
thing::factory Account
Account proc init {Account {Value 0} {Type Debit}} {
$Account variable Name $Account
$Account variable Balance $Value
$Account variable Type $Type
}
Account method show {Account {Chan stdout}} {
puts $Chan "Balance of account [$Account get Name] is [$Account get Balance]"
}
Account method deposit {Account Value} {
incr ${Account}::Balance $Value
}
Account create RichieRich 1000000
Account::RichieRich show