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:03] – *stressed tvcutsem | at:tutorial:objects [2007/07/09 21:13] – rewrote tvcutsem | ||
---|---|---|---|
Line 36: | Line 36: | ||
> Point.x | > Point.x | ||
>>0 | >>0 | ||
- | > point.sumOfSquares() | + | > Point.sumOfSquares() |
>>0 | >>0 | ||
</ | </ | ||
Line 45: | Line 45: | ||
===== 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,3) | + | def anotherPoint := Point.new(2,3) |
</ | </ | ||
- | Every object understands the message '' | + | Every object understands the message '' |
- | AmbientTalk also provides a '' | + | < |
+ | > anotherPoint.x | ||
+ | >> 2 | ||
+ | > Point.x | ||
+ | >> 0 | ||
+ | > anotherPoint.x := 3 | ||
+ | >> nil | ||
+ | > Point.x | ||
+ | >> 0 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | AmbientTalk' | ||
+ | </ | ||
+ | |||
+ | 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