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 13:35, 19 May 2009
, 15 years ago→{{header|Tcl}}: Correction; do it the neater way!
m (→{{header|Tcl}}: formatting tweak) |
(→{{header|Tcl}}: Correction; do it the neater way!) |
||
Line 281:
incr v $x
}
method value {{var v}} {
variable
return [set $
}
destructor {
Line 292:
::summation
% set s [summation new]
% # Do the monkey patch!
% set [info object namespace $
now
% # Prove it's really part of the object...
% $s value time
now
%</lang>
|