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 18:57, 2 December 2009
, 14 years ago→{{header|Falcon}}
No edit summary |
|||
Line 118:
=={{header|Falcon}}==
Classes and singleton objects have a fixed structure which cannot be changed during runtime. However falcon does have capability to add variables/functions at runtime with Prototype based objects. Below are two of the prototype objects that allow adding variables at runtime. These are arrays and dictionaries (hashes for the perl type out there).<br><br>
'''Array:'''
In this example we add a function (which prints out the content of the array) and a new value. While we are not technically adding a "variable", this example is presented to show similar type of functionality.
Line 132:
</lang>
'''Dictionary:'''
In this example we create an object from a bless'ed dictionary. We assign
<lang falcon>
function sub_func( value )
|