Home Segments Index Top Previous Next

510: Practice

Adapt the program shown in Segment 509 such that it displays floor areas rather than volumes. First, write an appropriate member function for the box class. Then, make use of that box class member function by defining virtual functions in the railroad_car class hierarchy. Assume that engines, cabooses, and tank cars have no floor area.