Our Body has a Color
// the constructors for body
// the member functions we already know
virtual float GetVolume() =0;
virtual float GetSurface() =0;
// two more functions which deal with the color
virtual void setColor (Color *c);
virtual Color * getColor();
// the standard constructor first
// since we didn't specify a color...
color = new Color(0.,0.,0.);
// the constructor setting a color
// we just grab the pointer to the color provided.
our_color = 0; // we did not make the color class.
// if we made the color object, we must delete it here.
if (our_color) delete color;
// now the color-handling
void body::setColor (Color *c)
if (our_color) delete color;
Warning: this class design works but is flawed. We will later improve the design.