#include <iostream.h> 
class container {
  public: int percent_loaded;
};
class box : public container {
  public: double height, width, length;
    box (double h, double w, double l) {height = h; width = w; length = l;}
    double volume ( ) {return height * width * length;}
};
class railroad_car {
  public: railroad_car ( ) { }
};
class box_car : public railroad_car, public box {
  public: box_car ( ) : box (10.5, 9.5, 40.0) { }
};
// Define ordinary functions:
double slow_floor_space_function (box_car b) {
  return b.width * b.length;
}
double fast_floor_space_function (box_car& b) {
  return b.width * b.length;
}
void defective_loading_function (box_car b) {
  b.percent_loaded = 100;
  return;
}
void working_loading_function (box_car& b) {
  b.percent_loaded = 100;
  return;
}
main ( ) {
  box_car typical_box_car;
  cout << "                     Slow    Fast" << endl
       << "Area computations:   "
       << slow_floor_space_function (typical_box_car)
       << "     "
       << fast_floor_space_function (typical_box_car)
       << endl;
  typical_box_car.percent_loaded = 0;
  cout << "                                          Percent Loaded"
       << endl;
  cout << "Before calling either loading function:   "
       << typical_box_car.percent_loaded
       << endl;
  defective_loading_function (typical_box_car);  
  cout << "After calling defective_loading_function: "
       << typical_box_car.percent_loaded
       << endl;
  working_loading_function (typical_box_car);
  cout << "After calling working_loading_function:   "
       << typical_box_car.percent_loaded
       << endl;
}
