1. generalization (generalization)
In C + +, the corresponding inheritance, such as B is a generalization, in C + + performance as:
Class B:public a{public : B () {} Virtual ~b () {}}
</pre><pre>
2.implementation (realization)
In C + +, corresponding to the concept of virtual functions, such as B implemented a. is to implement the detailed function (interface) of the virtual function in a, which is represented in C + +:
Class a{ public:a () {}virtual ~a () {}virtual void fun (int x,int y) = 0;};
Class B:public a{public : B () {}virtual ~b () {} virtual void fun (int x,int y);}
3. Association (Associate)is a partnership,if B is associated with a, B knows the properties and methods of a (B can use the properties and methods of a),The parameters of the corresponding method in C + +:
Class B { public:b () {}virtual ~b () {}void fun (A *m_a);}
4. Aggregation relationship (Aggregation)
is the relationship between the general and the individual. is a United Nations-style organization, which is a kind of weakness including that each individual can exist independently. In C + + the corresponding attribute life cycle of the conceptual aggregation relationship, the individual life cycle is not the overall control.
Class b{public : B () {} Virtual ~b () {} A *m_a;}
in the detailed implementation. The individual of a is generated outside of B. It is possible to pass an individual in the form of a pointer to B at the appropriate time. 5. Composition relationship (composition)is the relationship between the general and the individual. is a kind of die organization, is a kind of strong including, each individual can not exist independently. In C + +, the life cycle of an individual is dominated by the overall concept of the corresponding attribute life cycle.
Class b{public : B () {} Virtual ~b () {} A m_a;}
Pointers can also be used in detailed implementations. It's time to be aware that B is in charge of A's life and death.
The concept of modeling language is related to the concept of programming language (must read for beginners)