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

  • Learning Scala Programming
  • Vikash Sharma
  • 142字
  • 2021-06-30 19:07:50

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
主站蜘蛛池模板: 高邑县| 诸暨市| 枣强县| 普兰县| 昔阳县| 思茅市| 凤冈县| 雅安市| 荔波县| 福安市| 涡阳县| 浦东新区| 慈溪市| 高尔夫| 宁南县| 岳西县| 长治市| 三江| 皋兰县| 昭通市| 鸡泽县| 甘洛县| 竹山县| 师宗县| 沈阳市| 金沙县| 兰坪| 玉山县| 吉木乃县| 上饶县| 洛扎县| 色达县| 宁化县| 双峰县| 荃湾区| 苗栗县| 阜新市| 繁昌县| 宝丰县| 珠海市| 周口市|