Chapter 12
How does implementation inheritance differ from behavior subtyping?
Implementation inheritance allows a subclass to inherit both fields and methods from a super-class. Behavior subtyping allows a subtype to inherit methods defined for a super-type.
What are some major issues associated with implementation inheritance?
Implementation inheritance is problematic because sometimes, the subclass may not want to inherit the fields from a super-class even when it makes logical sense to define the parent-child relationship. As demonstrated from the square-rectangle problem, a subclass may be more restrictive and take away features rather than adding new functionality on top of the super-class. Second, implementation inheritance suffers ...
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