泛化和专业化-有什么区别 [英] Generalization and Specialization - What is the differences
问题描述
我很难找到一个概论与一个概论之间的区别,以及何时使用二者之一.
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屋!