• Home
  • Posts
  • Contact

Inheritance - Diamond problem

Table of Contents
  • Tags

The “diamond problem” is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If there is a method in A that B and C have overridden, and D does not override it, then which version of the method does D inherit: that of B, or that of C?

Tags

  1. Java - solving the diamond problem with default methods in interfaces
  2. Favor composition over inheritance

Links to this note

  • Inheritance



© 2025 . Generated with Hugo and Mainroad theme.