Sealed Classes in Kotlin

Learn how to use sealed classes in Android

Introduction

Sealed Classes in Kotlin is another new concept which we don’t have in traditional Java. Sealed class is sort of an extension to the traditional ENUM classes.

A sealed class allows you to represent constrained hierarchies in which an object can only be of one of the given types.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store