Last active
February 22, 2019 09:52
-
-
Save renaudcerrato/46c2b1db8aa03f0e735731a271dde577 to your computer and use it in GitHub Desktop.
Kotlin Nested Classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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