#include <iostream.h>
int current_year = 2001;
const double pi = 3.14159;
class container {
  public: int percent_loaded;
          // Default constructor:
          container ( ) { }
};
class railroad_car {
  public: int year_built;
          // Default constructor:
          railroad_car ( ) { }
          int age ( ) {return current_year - year_built;}
};
class box : public container {
  public: double height, width, length;
          // Default constructor:
          box ( ) { }
          // The box volume member function;
          double volume ( ) {return height * width * length;}        ///
};
class box_car : public railroad_car, public box {
  public: // Default constructor:
          box_car ( ) {height = 10.5; width = 9.2; length = 40.0;}
};
class gondola_car : public railroad_car, public box {
  public: // Default constructor:
          gondola_car ( ) {height = 6.0; width = 9.2; length = 40.0;}
          // The gondola volume member function;
          // gondola cars are loaded above their rims:
          double volume ( ) {return 1.2 * height * width * length;}  ///
};
main ( ) {
  // Construct a gondola car:
  gondola_car g;
  // Display volume; use the gondola class volume function:
  cout << "Viewed as a gondola, the car's volume is "
       << g.volume ( ) << " units." << endl;
  // Display volume; use the box class volume function
  cout << "Viewed as a box, the car's volume is "
       << g.box::volume ( ) << " units." << endl;
}
