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 15:00, 10 August 2017
, 6 years ago→{{header|Elena}}
Line 326:
=={{header|Elena}}==
ELENA does not support adding a field at run-time but it can be simulated with the help of a mix-in.
ELENA 3.
<lang elena>import extensions.
class Extender :: BaseExtender
{
object prop foo ::
constructor new : anObject
Line 344 ⟶ 345:
// extending an object with a field
anObject := Extender new
anObject foo := "bar".
console printLine
console readChar.
|