Data Type Inheritance
Extend data types with more specific sub-types
Inheriting a data type
Data types can now inherit from (or be extended by) other data types. For example, Integer
and Real Number
may both extend Number
. This is because they are both a strict subset of the latter. In other words, any Integer
is a Number
, but not every Number
is a valid Integer
(i.e. some numbers may contain decimal points).
How data type inheritance is used
When you declare a data type with children as the expected type of an attribute type (i.e. a property type), both it and any data type which extend it will be valid inputs. In this way you can think of child data types as being more strict or specific versions of their parents.
Abstract data types
With the introduction of data type inheritance, data types may now also be "abstract". Like ordinary data types, abstract data types can be declared as the expected value of an attribute - and abstract data types may have children. However, uniquely, data cannot be inputted as an abstract data type.
An example abstract data type is Currency
. It contains lots of children, such as Euro (EUR)
, Pound sterling (GBP)
and United States dollar (USD)
. However, even when Currency
is the expected data type of an attribute, information cannot be inputted as Currency
, because it is an "abstract" type, but only as one of its children.
Discover more updates
Create a free account
Sign up to try HASH out for yourself, and see what all the fuss is about
By signing up you agree to our terms and conditions and privacy policy