DEV Community

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

Posted on

1

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)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post