Home Segments Index Top Previous Next

433: Mainline

Finally, the original program contains a for loop that computes the sum of the volumes of the cylinder objects:

for (counter = 0; counter < limit; ++counter) 
  sum = sum + oil_tanks[counter].volume ( ); 

The for loop in the modified program has to dereference pointers to cylinder objects:

for (counter = 0; counter < limit; ++counter) 
  sum = sum + oil_tank_pointers[counter] -> volume ( );