泛化和专业化 - 有什么区别 [英] Generalization and Specialization - What is the differences

查看:28
本文介绍了泛化和专业化 - 有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难真正找到泛化和专业化之间的区别,以及何时使用任何一个.

I am having a hard time actually finding the difference between a Generalization and a Specialization, and when to use either one.

谁能给我指点一下?

最终也是一个使用 UML 的插图

Eventually also an illustration using UML

推荐答案

Animal 是泛化,Dog 是特化.您的超类是一个通用类,但您的子类将是您的超类的专门继承者.随着您在继承层次结构中向下移动,它会变得更加专业化和普遍化.

Animal is a generalization , Dog is specialization. Your superclass is a generalized class , but your subclass will be a specialized inheritor of your superclass. It becomes more specialized and less generalized as you move down the inheritance hierarchy .

泛化是从两个或多个类中提取共享特征,并将它们组合成一个泛化超类的过程.共享特征可以是属性、关联或方法.

Generalization is the process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. Shared characteristics can be attributes, associations, or methods.

如果从现有的超类创建一些新的子类来完成超类的特定工作,则称为特化.

If some new subclasses are created from an existing superclass to do specific job of the superclass, then it is known as specialization.

您可以获得更清晰的 UML 图教程 这里.

You can get more clear tutorial with UML diagrams here.

这篇关于泛化和专业化 - 有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆