Let’s say we have a set of related classes that we’ve created by subclassing. How about a
generic Shape superclass and a set of specific subclasses like Circle, Square, and Triangle?
When we wish to draw each shape on the screen, wouldn’t it be nice if we could just tell each
shape to draw itself without having to know in advance what type of shape we’ll be drawing?
For example, in a drawing program, we might treat each illustration as a collection of shapes.
We want to tell the program to draw all the shapes in the drawing, without having to go “Hmm,
is the first shape a circle or a square or a triangle? I’d better find out before I draw the shape.” If
we had specific methods like DrawCircle or DrawSquare, we’d be forced to do just that. We’d
rather just go “Hey, first shape. Draw yourself, whatever you are.” In other words, we want to
send the same method call, Draw, to any of the subclasses and have it perform the correct action.
A Circle would draw itself as round; a Square would draw a shape with four corners and
perpendicular sides.