官术网_书友最值得收藏!

Type constraints

Type constraints are rules associated with a type. They define a subset of all types that, for example, a variable can have. A type constraint takes the form of lower bound (subtype relation) or upper bound (supertype relation). It is possible to define multiple constraints for a single type. In this case, a type must satisfy both of them. Constraints are defined using the symbols >: (lower, unhappy bound) and  <: (upper, happy bound), and the direction of the sign corresponds to the reversed direction of the arrow on the UML diagram, as shown in the following screenshot:

The type constraints are inclusive, which is why type B represents both the upper and lower bounds. Besides B in our type hierarchy, only A obeys the LOWER type constraint and only  obeys the UPPER constraint.

主站蜘蛛池模板: 阿瓦提县| 高淳县| 乳源| 永新县| 休宁县| 永和县| 城固县| 恭城| 安徽省| 凤冈县| 吉林省| 理塘县| 奈曼旗| 徐汇区| 普兰店市| 洪江市| 甘德县| 沈丘县| 城固县| 新平| 公主岭市| 县级市| 武强县| 普宁市| 长乐市| 和政县| 清镇市| 马关县| 远安县| 汝南县| 杨浦区| 盘山县| 鹤山市| 武邑县| 上杭县| 南通市| 丰台区| 寿光市| 西青区| 茌平县| 普格县|