Anonymous user
Add a variable to a class instance at runtime: Difference between revisions
Add a variable to a class instance at runtime (view source)
Revision as of 22:32, 24 August 2010
, 13 years ago→{{header|Tcl}}: condense the requirements
No edit summary |
m (→{{header|Tcl}}: condense the requirements) |
||
Line 580:
=={{header|Tcl}}==
{{works with|Tcl|8.6}} or {{libheader|TclOO}}
The code below uses the fact that each object is implemented as a namespace, to add a ''time'' variable to an instance of ''summation'':
<lang Tcl>%
% oo::class create summation {
constructor {} {
variable v 0
|