Nested LoopsTopThis week's labSummary of objects & classes

Summary of objects & classes

We have now seen three different kinds of objects/classes:

  1. Objects that inherit graphicApplication. They pop up the graphics window, have access to the canvas and may contain methods (such as onMouseClick(pt: Point)) to respond to mouse events.
  2. Classes that don't extend anything. They take parameters that are used to initialize defs and variables necessary to represent objects. They may contain any methods necessary. Examples include Tshirt, Magnet, etc.
  3. Classes that represent animations. They import "animation", typically include a start method that includes a looping construct of the form animator.whilepausing()do{}finally{} They also require parameters and contain code to do initialization. The rest of the program continues execution while the animator loops repeatedly.

    Objects are created from these classes as usual, but you must then send them a start method request to get the animation started.

See the dripping paint example, which is very much like the tree from the previous lecture: Demo. Dripper.


Nested LoopsTopThis week's labSummary of objects & classes