User Tools

Site Tools


at:tutorial:objects

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
at:tutorial:objects [2007/07/09 21:00] – * tvcutsemat:tutorial:objects [2007/07/09 21:03] – *stressed tvcutsem
Line 34: Line 34:
  
 <code> <code>
-point.x +Point.x 
->>2+>>0
 > point.sumOfSquares() > point.sumOfSquares()
->>13+>>0
 </code> </code>
  
-This code shows two messages sent to the ''point'' object defined above in this section. The ''x'' message acts as an accessor for the ''x'' field. The ''sumOfSquares'' message selects the ''sumOfSquares'' method and evaluates its body.+This code shows two messages sent to the point object defined above. The ''x'' message acts as an accessor for the ''x'' field. The ''sumOfSquares'' message looks up the ''sumOfSquares'' method in the object and applies it. 
 + 
 +Note that the "prototypical" point object defined above can act as a stand-alone object. This is different from a class in a class-based language, which often requires the use of ''static'' fields or methods to be used stand-alone.
  
 ===== Cloning and instantiation ===== ===== Cloning and instantiation =====
at/tutorial/objects.txt · Last modified: 2013/05/17 20:23 by tvcutsem