transferred from: http://www.cnblogs.com/silent2012/archive/2011/09/07/2169946.html
1. What is a class diagram
Class diagram are mainly used to describe the structural design of a system. Class diagrams are also the most commonly used UML diagrams, with class diagrams showing classes, interfaces, and the static structure and relationships between them.
2. Elements of a class diagram
The following model elements are included in the class diagram: Class, Interface (Interface), dependency (Dependency) relationship, generalization (generalization) Relationship, Association (association) relationship, Aggregation relationships (Aggregation), composition relationships (composition), and implementation (realization) relationships.
Category 2.1 (Class)
In object-oriented (OO) programming, a class is an abstraction of a group of objects with the same characteristics in the real world.
2.2 Interface (Interface)
An interface is a special class that has the structure of a class but cannot be instantiated and can only be implemented (inherited). In UML, an interface is represented using a small circle with a name.
2.3 Dependency (Dependency) relationship
A dependency is a dependency between two or more classes, such as a plant class that relies on a soil class. Dependencies can also be subdivided into 5 types, which are bound (binding) dependencies, implementation (realization) dependencies, usage dependency, abstraction (abstraction) dependency, and Authorization (Permission) dependencies.
A dependency is represented by a dashed arrow that points to a dependent direction.
2.4 Generalization (generalization) relationship
Simply speaking, it is the inheritance relationship between classes. In UML, the generalization relationship is represented by a hollow triangle + solid line, and the arrow points to the parent class.
2.5 Aggregation (Association) relationship
An aggregation relationship is a weaker coupling between classes, such as a string array and a string that is an aggregation relationship. In UML class diagrams, aggregation relationships are represented by hollow Diamond + solid arrows, and arrows point to classes that are aggregated.
2.6 combination (Aggregation) relationship
A combinatorial relationship is a relationship between a whole and a part of a class, such as a frog with four legs, and a relationship between a frog and a frog's leg class. In a UML class diagram, a composite relationship is represented by a solid diamond + solid arrowhead, and the arrow points to the grouped class.
2.7 Association (composition) relationship
Association relationship is a kind of relationship between classes, the direction of influence is the direction of association. In a UML class diagram, a composite relationship is represented by a solid arrow.
2.8 Implementation (REALIZATION) relationship
In general, the implementation relationship is for the relationship between the class and the interface. In UML class diagrams, the implementation relationship is represented by a hollow triangle + dashed line.
3. Simple example of class diagram
UML Learning (ii)-----class diagram