“list of Bodies” code example
// the declaration of the totalVolume call.
float totalVolume (body *bptr[]);
bodylist[0] = new cube(1.25);
bodylist[1] = new cube(1.);
bodylist[2] = new cylinder(1,1);
bodylist[3] = new cylinder(0.5,2);
bodylist[4] = new cube(1.25);
bodylist[5] = new cylinder(1,2);
bodylist[6] = new cylinder(1,0.5);
bodylist[7] = new cylinder(3,2);
cout << "Total volume is: " << totalVolume(bodylist) << endl;