DEV Community

Cover image for Kotlin, classes inside interface, interface inside classes, sealed classes, data classes and so on.
fy
fy

Posted on

Kotlin, classes inside interface, interface inside classes, sealed classes, data classes and so on.

I recently started reading kotlin docs, it has a lot of features in oop. Its cool but at the same time i can't help but wonder why do we need this? I was doing fine with data class, sealed class, inner class and such but interfaces inside classes, classes inside interfaces and so on just blew my fuse.

interface AnInterfaceIsJustAContractNothingMore {
    class WaitUntilYouCodeInKotlin {
        fun OhNo(): String {
            return "I cant even tell the difference anymore. Its like blending diff realities."
        }

        interface ThisWorksToo {
            class EvenThis {
                val why = "Why do i need this?"
            }
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

I am writing this to express my opinion at the same time have some opinions on how other people feel about this?

Top comments (0)