https://kotlinlang.org logo
#getting-started
Title
# getting-started
k

Karlo Lozovina

05/27/2022, 5:27 PM
Are there other languages with feature similar to Kotlin's inner claseses?
a

andylamax

05/27/2022, 5:30 PM
Java inner classes???
e

ephemient

05/27/2022, 5:30 PM
straight from Java, where all nested classes are inner classes by default unless explicitly declared static
k

Karlo Lozovina

05/27/2022, 6:30 PM
huh, should've said outside of the Kotlin/Java/Scala ecosystem 🙂 Python, C#? Something more exotic? I'm guessing Rust/Go don't have anything similar to that...
e

ephemient

05/27/2022, 6:35 PM
C# has nested classes with reference to parent (like Java) Python has nested classes with no reference to parent (unless you add one explicitly)
Rust and Go don't have classes in the same form, so it's not comparable
but honestly the JVM doesn't really care about nested classes (aside from some access visibility), it's almost entirely a Java (etc.) language convention
2 Views