The class diagram
 
The class diagram in UML is used to model the static structural elements. It captures and defines the objects, entities and building blocks of a system. Classes are the generalized templates from which run-time objects are created. Components are built from classes. Classes (and interfaces) are the design elements that correspond to the coded or developed software work products.

A class represents a set of objects with the same characteristics. Using classes to classify objects reduces complexity and the number of elements necessary for modelling.
 
Classes are described with names, attributes and operations. Relationships between classes are described with a name, roles and multiplicity.
An attribute is a property of a class. It describes a range of values that the property may hold in objects of the class. A class may have zero or more attributes.
An operation is something that a class can do, or that an actor (or another class) can do to a class.
Interfaces are abstract classes with a behavioural component only. They specify an operational contract that an implementer agrees to meet. An interface cannot be instantiated at run time - it is an abstract element. Instead, a class may be defined, which 'implements' this interface.
Classes may be related in a variety of ways. The following are the most common:
 
  • Association - Association relationships capture the static relationships between entities. These generally relate to one object having an instance of another as an attribute or being related in the sense of owning (but not being composed of).
  • Aggregation - Aggregation relationships define whole/part relationships. This relationship is shown as a line with a diamond towards the whole class. The stronger form of aggregation is composition and infers that a class not only collects another class, but also is actually composed of that collection at a point in time.
  • Dependency - A dependency is a type of relationship expressed between two classes in which one class relies on the other.
  • Realization - A realisation shows that one class realizes another.
  • Inheritance - Inheritance describes the hierarchical relationship between classes. It describes the 'family tree'. Classes may inherit attributes and behaviour from a parent class (which may in turn be the child of another class).  This tree of inherited characteristics and behaviour allows the designer the ability to collect common functionality in root classes (ancestors) and refine and to specialize that behaviour over one or more generations (children). Scope specifies (public, protected and private) determine which elements may be inherited and which are not visible.
An example follows:
graphic
  
Google
 
Web xpdian.com