at:tutorial:objects
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
at:tutorial:objects [2007/07/09 21:00] – * tvcutsem | at:tutorial:objects [2007/07/09 21:13] – rewrote tvcutsem | ||
---|---|---|---|
Line 34: | Line 34: | ||
< | < | ||
- | > point.x | + | > Point.x |
- | >>2 | + | >>0 |
- | > point.sumOfSquares() | + | > Point.sumOfSquares() |
- | >>13 | + | >>0 |
</ | </ | ||
- | This code shows two messages sent to the '' | + | This code shows two messages sent to the point object defined above. The '' |
+ | |||
+ | Note that the " | ||
===== Cloning and instantiation ===== | ===== Cloning and instantiation ===== | ||
- | As said before in this section, AmbientTalk objects are created [[objects# | + | As noted above, AmbientTalk objects are created [[# |
+ | |||
+ | < | ||
+ | def anotherPoint := Point.new(2, | ||
+ | </ | ||
+ | |||
+ | Every object | ||
< | < | ||
- | > def anotherPoint | + | > anotherPoint.x |
+ | >> | ||
+ | > Point.x | ||
+ | >> 0 | ||
+ | > anotherPoint.x := 3 | ||
+ | >> nil | ||
+ | > Point.x | ||
+ | >> 0 | ||
</ | </ | ||
- | Every object | + | < |
+ | AmbientTalk' | ||
+ | </ | ||
- | AmbientTalk also provides a '' | + | AmbientTalk also provides a '' |
< | < | ||
- | > def clonedPoint := clone: | + | def clonedPoint := clone: |
+ | > clonedPoint.x | ||
+ | >> 0 | ||
+ | > clonedPoint.x := 2 | ||
+ | >> nil | ||
+ | > Point.x | ||
+ | >> 0 | ||
</ | </ | ||
at/tutorial/objects.txt · Last modified: 2013/05/17 20:23 by tvcutsem