Class Coupling

Class Coupling:

Measures the coupling to unique classes through parameters, local variables, return types, method calls, generic or template instantiations, base classes, interface implementations, fields defined on external types, and attribute decoration.

Good software design dictates that types and methods should have high cohesion and low coupling.

High coupling indicates a design that is difficult to reuse and maintain because of its many interdependencies on other types.

Class coupling is nothing but a measure on how one class is connected or dependent with another class.

Example: Class coupling in below example is 1 initially and then changed to 2.