January 2020
Intermediate to advanced
532 pages
13h 31m
English
Having discussed abstract types and concrete types, you may be wondering how they differ from each other. We can summarize their differences in the following table:
| Property | Abstract Type | Concrete Type |
| Has a supertype? | Yes | Yes |
| Allows subtypes? | Yes | No |
| Contains data fields? | No | Yes |
| First class? | Yes | Yes |
| Can be part of a Union type? | Yes |
Yes |
For abstract types, we can build a hierarchy of types. The top-level type is just Any. Abstract types cannot contain any data fields as they are used to represent concepts rather than data storage. Abstract types are first-class, meaning that they can be stored and passed around, and there are functions that work with them—for example, the ...
Read now
Unlock full access