sealed class Gender{

data class Male(...)

data class Female(...)

}

val g:Gender = Gender.Female(...)

when(g){

is Gender.Male -> {/*do something*/}

is Gender.Female ->{/*do something*/}

else -> {/*do something*/}

}

................

as you can see Sealed classes provide a enum like syntax for doing stuff... we are actually comparing the instance type of our object, which could be of one of the children of sealed class, but never the sealed class itself.

g could never be defined as :

val g = Gender()

curiously fiddling around with tech | https://root-ansh.github.io/curioustools/