Subtyping vs Inheritance

Learn what is subtyping compared to inheritance.

We'll cover the following

Compared to modules

Compared to modules, there is a better way to specify a new implementation while maintaining the same behaviors, meaning to reuse code and extend original software. We won’t be using an inheritance mechanism to copy over variables and methods from one object to another, but we’ll instead use subtyping.

For example, a duck, a cuckoo, and an ostrich are all subtypes of a bird:

Get hands-on with 1400+ tech skills courses.