In class diagrams, a dependency relationship indicates that a change to one class, the supplier, might cause a change in the other class, the consumer. The supplier is independent because a change in the consumer does not affect the supplier.
For example, a Cart class depends on a Product class because the Product class is used as a parameter for an add operation in the Cart class. In a class diagram, a dependency relationship points from the Cart class to the Product class. In other words, the Cart class is the consumer element, and the Product class is the supplier element. A change to the Product class may cause a change to the Cart class.
In class diagrams, dependency relationships in a C/C++ application connect two classes to indicate that there is a connection between the two classes, and that the connection is more temporary than an association relationship. A dependency relationship indicates that the consumer class does one of the following things:
As the figures in the following table illustrate, a dependency relationship connector appears as a dashed line with an open arrow that points from the consumer class to the supplier class. A dependency relationship means an "import" statement.
C/C++ source code | UML visualization |