Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
complexvalues [2019/01/04 16:21]
christian [Using Values]
complexvalues [2019/01/04 16:38]
christian [Using Values]
Line 38: Line 38:
 </code> </code>
  
-And you can do:+Withit you can:
   * create a value with <code smalltalk>person := Person example</code>   * create a value with <code smalltalk>person := Person example</code>
-  * ask it for its parts <code smalltalk>person name  "returns 'Christian Haider' "</code> +  * ask for its parts <code smalltalk>person name  "returns 'Christian Haider' "</code> 
-  * print the instance as code <code smalltalk>person asSource  "returns+  * print it as code <code smalltalk>person asSource  "returns
 'Person 'Person
     name: ''Christian Haider''     name: ''Christian Haider''
Line 47: Line 47:
     birthday: (Date d: 25 m: 6 y: 1960)' "</code>     birthday: (Date d: 25 m: 6 y: 1960)' "</code>
   * get the value from its code <code smalltalk>person class evaluate: person asSource "returns a value equal to person"</code>   * get the value from its code <code smalltalk>person class evaluate: person asSource "returns a value equal to person"</code>
 +  * add fancy access methods like <code smalltalk>
 +weekdayAtBirth
 +  ^self birthday weekday
 +</code>
  
  
  • complexvalues.txt
  • Last modified: 2022/03/06 08:57
  • by christian