Features to Note

Here are some of the features to note in relation to this method.

A graphics context is passed as an argument to the drawing routines. This graphics context is a facilitator class, it provides the user with assistance in performing graphical operations, such as drawing lines or circles.

A large number of drawing primitives are provided in the standard library, make available as member functions for the graphics context object.

Many classes provide symbolic constants, as did our card class. A good example is the class Color, which provides constants that represent some of the more common colors. These can be accessed by forming a qualified name, consisting of the class name, period, then constant name. An example is Color.red.

Our cards are rather plain, however, if you want to get fancy, there are routines for printing bit-maps, so you can create your own card classes that look much nicer than these.

Finally, an important principle of object-oriented programming is that each object is responsible for itself. Note how the card is responsible for maintaining its own state, and for printing itself. Try to follow this in your own programs. Make your objects responsible for their own actions.

[audio] [real] Text to accompany slide7, in Chapter 8 of An Introduction to Object-Oriented Programming