MAIN.CXX
We can now include the ball.h file in place of the sphere.h file because it declares the sphere class within.
The class ball now has inherited the member variables and member functions for position and size.
#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 myBall;
	myBall.copy(myOtherSphere);
	myBall.setRadius(20.0);
	myBall.setVelocity(0.2,0.0,1.0);
	while (1)
		{
		//report the ball position and velocity
		cout << "myBall has position X: " << myBall.getXPosition();
		cout << " Y: " << myBall.getYPosition();
		cout << " Z: " << myBall.getZPosition() << endl;
		cout << "myBall has velocity X: " << myBall.getXVelocity();
		cout << " Y: " << myBall.getYVelocity();
		cout << " Z: " << myBall.getZVelocity() << endl;
		//simulate the ball flight
		myBall.fall();
		//start the ball again if resting
		if (myBall.getZPosition() <= 0.0)
			{
			myBall.setPosition(3.0,4.0,10.0);
			myBall.setVelocity(0.2,0.0,1.0);
			}
		}
	};