Add a variable to a class instance at runtime: Difference between revisions

Content deleted Content added
Line 1,291:
foreach pilot squadron [probe pilot]
</lang>
 
=={{header|Ring}}==
We can add an attribute (or a group of attributes) to the object state using addattribute() function
==== Example ====
<lang ring>o1 = new point
addattribute(o1,"x")
addattribute(o1,"y")
addattribute(o1,"z")
see o1 {x=10 y=20 z=30}
class point</lang>
{{out}}
<pre>
x: 10.000000
y: 20.000000
z: 30.000000
</pre>
 
=={{header|Ruby}}==