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

Scala's class hierarchy

Let's discuss Scala's class hierarchy, and also a few extra types that exist, such as bottom types in Scala. Scala has a unified type hierarchy, which means there's only one top-level class that's Any, and all other types extend directly or indirectly from this top-level type. It also means that any class that we define or a class pre-existing in Scala, has access to universal methods defined in the top-level class Any. Two variants of a relationship shown in the following figure are subtypes and view. The first one, subtypes depicts a relationship between two types, whereas the latter one shows that one type can be typecasted to another one. View relations are shown for value types, where a Char can be typecasted into Int.

The following figure shows the relationship between classes in Scala:

Scala class hierarchy
主站蜘蛛池模板: 中江县| 澎湖县| 张家口市| 乌拉特中旗| 额敏县| 平和县| 临沂市| 东海县| 京山县| 遂溪县| 泽普县| 赤壁市| 云和县| 冕宁县| 绥中县| 施甸县| 四会市| 丹阳市| 阳曲县| 五家渠市| 恩平市| 襄汾县| 旌德县| 峨眉山市| 时尚| 营口市| 辽源市| 屯昌县| 宣武区| 晴隆县| 梁平县| 桃园市| 灵台县| 库尔勒市| 锡林浩特市| 商水县| 西昌市| 钟山县| 兴和县| 灵武市| 青岛市|