When to use class diagram?
It is a part of the logical view.
1. Class relationships.
2. Constraints.
Invariant is a constraint that must be always true. It is usually defined on class attributes.
Precondition is a constraint that is defined on method and is checked before the method executes. It is usually used to validate the input parameters to a method.
Postconditionis a constraint that is defined on method and is checked after the method executes. It is usually used to describe how values are changed by a method.
3. Class name in italics means the class is abstract class.
4. The interface is shown as the following diagram.