Describe Aggregation & Composition between classes, give example.
A "owns" B = Composition : B has no meaning or purpose in the system without A
A "uses" B = Aggregation : B exists independently (conceptually) from A
Example 1:A Company is an aggregation of People. A Company is a composition of Accounts. When a Company ceases to do business its Accounts cease to exist but its People continue to exist.
Example 2: (very simplified)A Text Editor owns a Buffer (composition). A Text Editor uses a File (aggregation). When the Text Editor is closed, the Buffer is destroyed but the File itself is not destroyed.
Aggregation(empty rectangle): If a dog breed goes extinct, dogs don't go extinct.
Composition(filled rectangle): If dogs go extinct, the dog breed also goes extinct.