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 12:26, 2 March 2009
, 15 years ago→{{header|Ruby}}: lang tag
m (→{{header|Ada}}: Another case problem) |
m (→{{header|Ruby}}: lang tag) |
||
Line 187:
=={{header|Ruby}}==
end
Line 193:
e.instance_variable_set("@foo", 1)
e.instance_eval("class << self; attr_accessor :foo; end")
puts e.foo</lang>
|