Skip to content

Instantly share code, notes, and snippets.

@renaudcerrato
Last active February 22, 2019 09:52
Show Gist options
  • Save renaudcerrato/46c2b1db8aa03f0e735731a271dde577 to your computer and use it in GitHub Desktop.
Save renaudcerrato/46c2b1db8aa03f0e735731a271dde577 to your computer and use it in GitHub Desktop.
Kotlin Nested Classes
class A {
// nested class (equivalent to static in Java)
class B {
// A can't see private members of nested classes
private val invisible = 42
}
// inner class
inner class C {
// A can't see private members of inner classes
private fun invisible() = 42
}
}
val b = A.B()
val c = A().C()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment