EuroTcl 2023
- Jim and Tcl interoperability, Featuring thing o_o, Georg Lehner, 2023-07-20
thing
Makers
thing::maker Account
Account proc init Self {variable $Self; set $Self 0}
Account proc init {Account {Value 0}} {
variable $Account; set $Account $Value
}
Account proc show {Account {Chan stdout}} {
puts $Chan "Balance of account $Account is [get $Account]"
}
set RichieRich [Account new 1000000]
$RichieRich show
Account incr $RichieRich 1000000
Account proc deposit {Account Value} {variable $Account; incr $Account $Value}
Account deposit $RichieRich 1000000
$RichieRich deposit 1000000