gpt4 book ai didi

terminology - 继承、组合、聚合、委托(delegate)的通用名称是什么?

转载 作者:行者123 更新时间:2023-12-03 06:14:20 24 4
gpt4 key购买 nike

程序被分割成小对象后,这些小对象必须相互连接起来。哪里有不同类型的连接。继承、组合、聚合、委托(delegate)。这些类型有多种类型和模式,例如松耦合、紧耦合、控制反转、通过接口(interface)委托(delegate)等。上述连接类型的正确通用名称是什么?我可以建议它们都被称为“耦合”,但我在谷歌中找不到任何好的分类,所以也许我试图使用错误的术语?也许有人知道一个可靠的、值得信赖的分类,我可以使用它作为术语?

最佳答案

这些通常称为“关系”。

Glossary of Java and Related Terms

取自 Object-Oriented Programming with Java:An Introduction通过 David J. Barnes :

有一个关系

See aggregation.

是一个关系

See inheritance.

类继承

When a super class is extended by a sub class, a class inheritance relationship exists between them.

聚合

A relationship in which an object contains one/more other subordinate objects as part of its state.

委托(delegate)

The process by which an object passes on a message it has received to a sub-ordinate object. If inheritance is not available in a programming language, delegation is the most viable alternative for avoiding code duplication and promoting code reuse.

关于terminology - 继承、组合、聚合、委托(delegate)的通用名称是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2915352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com