Designing abstract types
Similar to many other objected-oriented programming languages, Julia supports a hierarchy of abstract types. Abstract types are typically used to model real-world data concepts; for example, an Animal could be an abstract type for a cat or dog, and a Vehicle can be an abstract type for a car, truck, or bus. Being able to group types together and give the group a single name allows Julia programmers to apply generic code that is common to those types.
Abstract types are often conveniently defined in a type hierarchy for a specific domain. We can describe the relationship between abstract types as parent–child, or more technically, an is-a-subtype-of relationship. The terminology for the parent type and child type is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access