Home Segments Index Top Previous Next

254: Mainline

The no-duplication principle: Member variables and function definitions should be distributed among class definitions to ensure that there is no duplication of identical code. Otherwise, duplicate copies are bound to become gratuitously different.

In the version of the program in Segment 239, for example, the height, width, and length member variables and volume member function reside in the box class, rather than in the box_car, making those member variables and member functions more generally available.