This content is available online.
In this module we will explore what is gained by modifying the inheritance-based Ballworld system (***Section 2.2***) into a composition-based system.
In the inheritance-based Ballworld system, we were able to generate quite a bit of flexibility and extensi bility. For instance, we could develop new kinds of balls and add them into the system without recompiling the rest of the code. This was accomplished by having the invariant ball creation and management code deal only with the abstract ball while the variant behaviors were encapsulated into the concrete subclasses.