UML

Aggregation “has-a” (C++)

If A has-a B, then generally:

  • B has an independent existence outside of A
  • If A dies, B lives on
  • If A is copied, B isn’t (shallow copy)

How is "has-a" implemented?

Generally implemented via references or non-owning pointers (one you don’t delete).

If a student dies, university lives on. if we copy a student, don’t copy whole university.