Teachpacks for How to Design Classes

A Geometry Library (HtDC)


This geometry package provides a class for representing positions in a Cartesian world:

                      +----------+
                      | Posn     |
                      +----------+
                      | int x    |
                      | int y    |
                      +----------+

To create an instance of the Posn class, a program must supply two int values: one for its x coordinate of the canvas and the second for its y coordinate.