MAIN.CXX
Explicitly creating our class objects within the program limits our flexibility.
We can create multiple balls and process them all similiarly if they are created dynamically.
Ball objects can be created and refered to with the use of pointers to class objects.
We can create a pointer to built-in or class data types with the * directive.
The new statement creates dynamic objects while the -> directive replaces the dot when refering to them.
#include <iostream.h>
#include "ball.h"
int main (void)
	{
	sphere mySphere;
	mySphere.setRadius(10.0);
	cout << "mySphere has radius: " << mySphere.getRadius() << endl;
	sphere myOtherSphere;
	myOtherSphere.copy(mySphere);
	myOtherSphere.setPosition(3.0,4.0,10.0);
	cout << "myOtherSphere has radius: " << myOtherSphere.getRadius() << endl;
	cout << "myOtherSphere has X position: " << myOtherSphere.getXPosition() << endl;
	ball* myBallArray[100];
	//create a new ball
	myBallArray[0] = new ball;
	//initialize the ball position
	myBallArray[0]->setPosition(3.0,4.0,10.0);
	myBallArray[0]->setRadius(20.0);
	myBallArray[0]->setVelocity(0.2,0.0,1.0);
	int ballNumber = 0;
	while (1)
		{
		//report the ball position and velocity of the last ball created
		cout << "ballNumber: " << ballNumber << endl;
		cout << "myBall has position X: " << myBallArray[ballNumber]->getXPosition();
		cout << " Y: " << myBallArray[ballNumber]->getYPosition();
		cout << " Z: " << myBallArray[ballNumber]->getZPosition() << endl;
		cout << "myBall has velocity X: " << myBallArray[ballNumber]->getXVelocity();
		cout << " Y: " << myBallArray[ballNumber]->getYVelocity();
		cout << " Z: " << myBallArray[ballNumber]->getZVelocity() << endl;
		for ( i=0; i<ballNumber; i++)
			{
			//simulate the ball flight
			myBallArray[i]->fall();
			//start the ball again if resting
			if (myBallArray[i]->getZPosition() <= 0.0)
				{
				myBallArray[i]->setPosition(3.0,4.0,10.0);
				myBallArray[i]->setVelocity(0.2,0.0,1.0);
				}
			}
		if (ballNumber < 99)
			{
			//increment the number of balls in flight
			ballNumber++;
			//create a new ball
			myBallArray[ballNumber] = new ball;
			//initialize the ball position
			myBallArray[ballNumber]->setPosition(3.0,4.0,10.0);
			myBallArray[ballNumber]->setRadius(20.0);
			myBallArray[ballNumber]->setVelocity(0.2,0.0,1.0);
			}
		}
	};