---
# System prepended metadata

title: '**Relationship types**'

---



# **Relationship types**

**A) association:** when class A uses class B as an attribute or the opposite **(represented as a line, or line with directions)** _direction of the association indicates that the destination does not know the source_

**self-association:** when a class uses an object from its self
**association divided into two types**
-   **Composition:** object instantiate (the New operators exist) inside the class **(represented as filled diamond-shaped at the start of association line)**
-   **Aggregation:** object instantiate passed from outside **(via constructor or setters)**

**--------------**
**B) Dependency:** class A used class B inside its methods **(represented as a dashed line, or dashed line with directions).**
**--------------**
**C) Generalization:** connects a subclass to its superclass **(represented as a line end with a triangle)**
**--------------**
**D) Realization:** connects a class with an interface that supplies its behavior specification **(represented as a dashed line end with a triangle)**
