大家好,关于association是什么意思?用法、例句很多朋友都还不太明白,今天小编就来为大家分享关于英语单词Association, Aggregation, Composition的区别的知识,希望对各位有所帮助!
1、Associationisarelationshipbetweentwoobjects,buttherelationshipbetweenthemcouldbemultipletypes.Itcouldbeone-to-one,one-to-many,many-to-one,many-to-many.Inotherwords,therelationshipisveryflexible(灵活的)andloose(松散的).
2、Insoftwareprogramming,anobjectmayusefunctionsprovidedbyanobjectofanotherclass,thiskindofrelationshipiscalledassociation.
3、AggregationandCompositionaresubsetsofassociation.
4、Aggregationisasubset(子集)ofassociation.Itdepicts(描述)adirectional(有方向的)associationbetweentwoobjects,whichmeansitisanassociationthatrepresents(代表)apart-wholeorpart-ofrelationship.Butthisrelationshipisnottoorestrictive,whichmeanstwoobjectscanexistwithouteachother.
5、Compositionisasubsetofaggregation.Thisrelationshipismostrestrictive(严苛的),whichmeansitrepresentsanownership(拥有)relationship.Thecontained(被包含的)objectcannotexistwithouttheexistence(存在)ofcontainer(容器、拥有者)object.
6、TherelationshipbetweenCaranditsEngineiscalledComposition.BecauseitsEnginecannotbeusedinanyothercar.
7、汽车与专属的发动机之间的关系是Composition。因为发动机离开汽车后,将没有单独存在的意义。
8、TherelationshipbetweenClassroomandStudentsiscalledAggregation.Becauseeachonecanstillexistwithouteachother.
9、教室与学生之间的关系是Aggregation。因为一个教室可以包含多个学生,并且两者都可以独立存在。(估计大家会觉得一个学生也可以在多个教室上课,所以不是Aggregation。这个确实不同的角度分析有不同的看法。但我个人更认为是Aggregation,因为学生不能包含教室)
END,本文到此结束,如果可以帮助到大家,还望关注本站哦!