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

Content added Content deleted
(→‎{{header|Smalltalk}}: Questioned incorrect allegation)
Line 401: Line 401:
=={{header|Smalltalk}}==
=={{header|Smalltalk}}==
{{incorrect|Smalltalk|It extends the class (adds a new instance var and new method that will exists even in brand new future instances of that class), not only the particular instance. -- The description of the problem must be reworded then, as it
{{incorrect|Smalltalk|It extends the class (adds a new instance var and new method that will exists even in brand new future instances of that class), not only the particular instance. -- The description of the problem must be reworded then, as it
asks for adding methods to the class, not the instance.}}
asks for adding variables to the class, not the instance.}}
<lang smalltalk>Object subclass: #Monkey
<lang smalltalk>Object subclass: #Monkey
instanceVariableNames: 'aVar'
instanceVariableNames: 'aVar'