Quidest?

Subtypes

ยท Lorenzo Drumond

The subtype relationship arises from the question: if first_var has type first_type, and second_var has type second_type, is it safe to assign first_var = second_var?

A criterion is the following:

This relation is thus called a subtype relation: second_type is a subtype of first_type

Example: integers are subtypes of real numbers. Integers are of course real numbers, but there are less of them. Also, every function that works on real numbers, works on integers, but integers support more operations, like bitwise shifts.

References

#programming #computer_science #typing