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

Content added Content deleted
Line 484: Line 484:
=={{header|ooRexx}}==
=={{header|ooRexx}}==
ooRexx does not directly expose instance variables to callers. Encapsulated access to instance variables is done via accesser methods for assignment and retrieval. In general, it is not possible to just dynamically add support, but it is possible to construct a class that allows for this to happen.
ooRexx does not directly expose instance variables to callers. Encapsulated access to instance variables is done via accesser methods for assignment and retrieval. In general, it is not possible to just dynamically add support, but it is possible to construct a class that allows for this to happen.
==Unknown Method Access==
===Unknown Method Access===
This example traps unknown method calls, then sets or retrieves the values in an encapsulated directory object.
This example traps unknown method calls, then sets or retrieves the values in an encapsulated directory object.
<lang ooRexx>
<lang ooRexx>
Line 525: Line 525:
self~init:.dynamicvar
self~init:.dynamicvar


</lang>
</lang>


==Dynamic Method Definitions==
==Dynamic Method Definitions==