Home Segments Top Top Previous Next

293: Mainline

In a small class definition, it does no particular harm for a four-parameter constructor to duplicate the assignment statements of a three-parameter constructor; in general, however, you should avoid duplicating any program fragment on the ground that, when you debug or improve the duplicated program fragment, you must make identical changes in more than one place, which is difficult for the author of a program to do without error, and is completely impracticable for someone else to attempt.

Accordingly, you need a way for the four-parameter constructor not only to do its own unique work, but also to call the three-parameter constructor.