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

m
(→‎{{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.
Anonymous user