Home Segments Index Top Previous Next

119: Mainline

Still another virtue of procedure abstraction is that you easily can change the way a computation is done. If you decide to measure size the way the U.S. Postal Service measures size, instead of by computing volume, you easily can redefine box_car_volume.

double box_car_volume (double h, double w, double l) {
  double result = h + w + l;  
  cout << "The post-office size is " << result << endl; 
  return result; 
} 

At this point, of course, you should also rename your function to bring the name into line with what the function does.