fork download
  1. Object subclass: #MyClass
  2. instanceVariableNames: 'myVariable'
  3. classVariableNames: ''
  4. poolDictionaries: ''
  5. category: 'UserDefinedClasses'.
  6.  
  7. !MyClass methodsFor: 'accessing'!
  8. setMyVariable: aValue
  9. myVariable := aValue! !
  10.  
  11. !MyClass methodsFor: 'accessing'!
  12. myVariable
  13. ^ myVariable! !
  14.  
  15. "Example Usage"
  16. | anInstance |
  17. anInstance := MyClass new.
  18. anInstance setMyVariable: 'Hello Smalltalk!'.
  19. anInstance perform: #myVariable put: 'Wat'.
  20. Transcript show: anInstance myVariable; cr.
Success #stdin #stdout 0.01s 9032KB
stdin
Standard input is empty
stdout
Object: MyClass new "<0x7f4a7d89a9f0>" error: did not understand #perform:put:
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
MyClass(Object)>>doesNotUnderstand: #perform:put: (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:19)
Hello Smalltalk!