If you work with the member variables in tank_car
objects using
constructors, readers, and writers only, you only need to change
what happens in member functions:
class tank_car { public: double diameter, length; tank_car ( ) {diameter = 7.0; length = 40.0;} tank_car (double r, double l) {diameter = r * 2.0; length = l;} double read_radius ( ) {return diameter / 2.0;} void write_radius (double r) {diameter = r * 2.0;} double read_diameter ( ) {return diameter;} void write_diameter (double d) {diameter = d;} double read_length ( ) {return length;} void write_length (double l) {length = l;} double volume ( ) {return .25 * pi * diameter * diameter * length;} };