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 21:48, 7 December 2020
, 3 years ago→{{header|Smalltalk}}
(→{{header|Smalltalk}}: commented the wrong example (long time passed since and original author did not care)) |
|||
Line 1,657:
then, again create a 2D Point object, add a z slot, change and retrieve the z-value, finally inspect it (and see the slots).
<lang smalltalk>p := Point x:10 y:20.
p addSlot:'z'. "instance specific added slot"
p z:30.
p z.
|