seniorOOP

What is the difference between interface and abstract class in depth?

Updated May 17, 2026

Short answer

Interfaces define contracts, while abstract classes provide partial implementation and shared state.

Deep explanation

Interfaces enforce a pure behavioral contract with no state (in most languages), while abstract classes allow shared fields, constructors, and partial method implementations. Abstract classes are used when there is a strong is-a relationship and shared logic, whereas interfaces are used for capability-based design. Overuse of abstract classes can lead to rigid hierarchies, while interfaces promote flexibility and multiple inheritance of behavior.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More OOP interview questions

View all →