I am having a hard time actually finding the difference between a Generalization and a Specialization, and when to use either one.
Can anyone enlighten me?
Eventually also an illustration using UML
I am having a hard time actually finding the difference between a Generalization and a Specialization, and when to use either one.
Can anyone enlighten me?
Eventually also an illustration using UML
Animal
是泛化,Dog
是专业化。您的超类是一个泛化类,但您的子类将是您的超类的专门继承者。当您向下移动继承层次结构时,它变得更加专业化和不那么通用化。
泛化是从两个或多个类中提取共享特征,并将它们组合成一个泛化的超类的过程。共享特征可以是属性、关联或方法。
如果从现有的超类中创建一些新的子类来完成超类的特定工作,则称为专业化。
您可以在此处获得更清晰的 UML 图教程。