Allan Caine
1 min readDec 12, 2018

--

There are appropriate uses of inheritance. For example, take an adapter which provides no-op implementation of an interface. In Kotlin, such an adapter must be made open. Otherwise, the adapter would serve no purpose.

There are other examples of appropriate use of inheritance. For example, Android programs make regular use of inheritance. The main activity class must subclass Activity.

Still, as the article points out, when enlarging the functionality of an existing class, composition is usually better than inheritance. Encapsulation is not broken.

Thank you for your comment. You have made a good point.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Allan Caine
Allan Caine

Written by Allan Caine

Senior Android Developer, TD Bank (Canada) (Opinions are my own)

No responses yet

Write a response