previous | start | next

## Implementing Associations

- Associations between classes are usually implemented in data fields.
- You need to make two important choices:
  - Do you store a single object, or a vector of objects?
  - Should you store objects or pointers?
- First decide what the multiplicity of the association is:
  - 1 : many (ex. every company has many employees)
  - 1 : 1 (ex. every bank account has one owner)
  - 1 : 0 or 1 (every department has 0 or 1 receptionist)
- For a "1 : many" relationship, you need to use a vector (or some other data structure).

previous | start | next