What could be substituted for myTypel?

Consider the following diagram:

What could be substituted for myTypel?
A . Number
B . Short or Long
C . any subtype of Number
D . any Type, there is no restriction

Answer: C

Explanation:

In the given diagram, myType1 is shown redefining prop1, which was originally of type Integer. Given that Integer is a subtype of Number, and myType1 is used in a redefinition context, it implies that myType1 must also be a subtype of Number. In UML, when a property is redefined, the redefining property must be type compatible with the property it redefines. Therefore, myType1 could be substituted by any subtype of Number, which includes Integer, Real, and all their subtypes (Short, Long, Float, Double, etc.). This is based on the UML principle of type conformance in property redefinition, as specified in the UML 2.x Superstructure Specification.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments