12

Kotlin, classes inside interface, interface inside classes, sealed classes, data...

 3 years ago
source link: https://dev.to/fy09/kotlin-classes-inside-interface-interface-inside-classes-sealed-classes-data-classes-and-so-on-4ee9
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for Kotlin, classes inside interface, interface inside classes, sealed classes, data classes and so on.

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

Dec 19

・1 min read

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 modeExit fullscreen mode

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK