はじめに
SubtypingとInheritanceについて説明します。
両者の違いを理解します。[1]を参照します。
Subtyping (サブタイピング)
Subtyping refers to compatibility of interfaces. A type B is a subtype of A if every function that can be invoked on an object of type A can also be invoked on an object of type B.
Subtypingはinterfaceの互換性に着目します。
AのすべてのfunctionがBにおいても呼び出すことができる場合、BをAのsubtypeといいます。
Inheritance (継承)
Inheritance refers to reuse of implementations. A type B inherits from another type A if some functions for B are written in terms of functions of A.
Inheritanceは実装の再利用に着目します。
AのfunctionによってBのいくつかのfunctionが実装されている場合、BはAを継承します。