首页 百科资讯 最新收录

association是什么意思(association的同义词及其用法)

小编:xiaojiong      分类:生活常识    信息来源:     阅读()

association是什么意思(association的同义词及其用法)

Association 
is a relationship between two objects, but the relationship between them could be multiple types. It could be one-to-one, one-to-many, many-to-one, many-to-many. In other words, the relationship is very flexible(灵活的) and loose(松散的).

In software programming, an object may use functions provided by an object of another class, this kind of relationship is called association.

association是什么意思

Aggregation and Composition are subsets of association.

Aggregation is a subset(子集) of association. It depicts(描述) a directional(有方向的) association between two objects, which means it is an association that represents(代表) a part-whole or part-of relationship. But this relationship is not too restrictive, which means two objects can exist without each other.

 

Composition is a subset of aggregation. This relationship is most restrictive(严苛的), which means it represents an ownership(拥有) relationship. The contained(被包含的) object cannot exist without the existence(存在) of container(容器、拥有者) object.

association的同义词及其用法

Example:

The relationship between Car and its Engine is called Composition. Because its Engine cannot be used in any other car.

汽车与专属的发动机之间的关系是Composition。因为发动机离开汽车后,将没有单独存在的意义。

The relationship between Classroom and Students is called Aggregation. Because each one can still exist without each other.

教室与学生之间的关系是Aggregation。因为一个教室可以包含多个学生,并且两者都可以独立存在。(估计大家会觉得一个学生也可以在多个教室上课,所以不是Aggregation。这个确实不同的角度分析有不同的看法。但我个人更认为是Aggregation,因为学生不能包含教室)

5 0

评论