Aggregation “has-a” (C++)
If A has-a B, then generally:
B
has an independent existence outside ofA
- If
A
dies,B
lives on - If
A
is copied,B
isn’t (shallow copy)
Generally implemented via references or non-owning pointers (one you don’t delete).
Quest example: (insert picture from CS247 - Software Engineering Principles)
If a student dies, university lives on. if we copy a student, don’t copy whole university.