




BALL.H
Our vector contains pointers to ball and not pointers to gravityBall.
As a result, the compiler will call the function associated with ball unless we instruct it otherwise.
We can us the virtual directive to indicate that fall may be overriden by a derived class.
The compiler will then call the fall function overriden by the gravityBall object.
#include "sphere.h"
class ball :public sphere
{
public:
ball(void);
~ball(void);
virtual void fall(void);
void expand(float);
void setVelocity(float, float, float);
inline float getXVelocity(void) { return xVelocity; }
inline float getYVelocity(void) { return yVelocity; }
inline float getZVelocity(void) { return zVelocity; }
protected:
float xVelocity;
float yVelocity;
float zVelocity;
private:
void resetVelocity(void);
};