Now watch...
0-terminated list of “pointers to body”
float totalVolume (body *bptr[])
volume += b->GetVolume();
This routine now calculates the total volume of all bodies in the list
This routine only sees (and knows about) “bodies”, it does not care whether a body is actually a cube or a cylinder. It will also work (without re-compilation!) with other classes of body which didn’t exist at the time we wrote this function, such as a sphere, a pyramid, or a cone.