如何在UML中表达互斥继承? [英] How to express mutually exclusive inheritance in UML?
本文介绍了如何在UML中表达互斥继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何举例说明一个类可以继承两个超类中的任何一个,但不能同时继承两个?
How to exemplify that a class can inherit either of two super-classes, but not both?
Property 类可以代表一个集合的数字,或者一个Cardinalstrong> 数字,但不是同一类型.
The class Property can either represent a Set of numbers, or a Cardinal number, BUT not both at the same type.
推荐答案
你的子类是颠倒的.您需要一个 Set Property
和一个专门用于 Property
的 Cardinal Property
.如果这些子类也具有 Set
和 Cardinal
的特征,您也可以将它们子类化.
Your sub classing is upside down. You need a Set Property
and a Cardinal Property
that specialize Property
. If those subclasses also have characteristics of Set
and Cardinal
, you could subclass those as well.
这篇关于如何在UML中表达互斥继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文