Skip to content
Sharp

Language Upgrades · interview question

How can sealed classes help in managing a complex class hierarchy in an e-commerce application?

Multiple choiceMediumchapter-12-curatedpremiumlanguage-upgradesmigration-strategy
Choose one answer
Answer and explanation

Correct answer

D. By restricting which classes can extend a given class

Why

Sealed classes provide a way to restrict which classes can extend a given class, offering a clear and controlled class hierarchy, which is particularly useful in maintaining complex systems like e-commerce applications.

Test yourself on Language Upgrades

A free test with instant, explained results. No account needed.

Start free test
All Language Upgrades questions →