Constructing with Color
cube::cube(float x, Color *c)
cube and cylinder get a new constructor:
cylinder::cylinder(float r, float h)
cylinder::cylinder(float r, float h, Color *c)
They pass the color on to the constructor for body which takes care of things.
The first constructor calls (by default) body() without parameters; this constructor assigns the default color (black) to the body.
- each constructed cube and cylinder just lets the parent class deal with the color attributes; there is no need to duplicate that functionality.
- the cube & cylinder classes inherit the functionality from their parents
- the parent (body) maintains the color as an associated class.
- we can change the color attribute at run time.