Add a variable to a class instance at runtime: Difference between revisions
Content added Content deleted
m (→{{header|Smalltalk}}: typo) |
|||
Line 1,663: | Line 1,663: | ||
p inspect. "shows 3 slots" |
p inspect. "shows 3 slots" |
||
"Point class is unaffected:" |
"Point class is unaffected:" |
||
p2 := Point x |
p2 := Point x:20 y:30. |
||
p2 z:40. -> error; Point does not implement z: |
p2 z:40. -> error; Point does not implement z: |
||
p2 inspect. "shows 2 slots" |
p2 inspect. "shows 2 slots" |