07 / 13

Can an Interface inherit from another Interface?

Difficulty: 2/10

Interface Inheritance

Yes. Interfaces can extend other interfaces. This allows a more specialized contract to inherit the operations of a broader contract. A class implementing the child interface must satisfy the inherited contract as well as the child's additional requirements. Both Java and C# support interface inheritance, and Java/C# also allow an interface to inherit from multiple interfaces.

javascript
  1. 1

    Interfaces can extend other interfaces.

  2. 2

    A child interface inherits the parent's contract.

  3. 3

    Multiple interface inheritance is supported in Java and C#.

  4. 4

    A concrete implementing class must satisfy the resulting contract.

  5. 5

    Interface inheritance should represent a genuine capability specialization.

Follow-up Questions

  • Can an interface extend multiple interfaces?
  • Can a class implement multiple interfaces?
  • What happens if parent interfaces contain conflicting defaults?
  • What is interface segregation?
Share

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.