Home Segments Index Top Previous Next

161: Mainline

In the program in Segment 155, you saw the volume function defined as follows for box_car objects:

double volume (box_car b) { 
  return b.height * b.width * b.length; 
} 

You can define volume to be even more specific to box_car objects by moving its definition into the definition of the box_car class. Such functions, like member variables, are said to be member functions of the classes in which they are defined.