Skip to content

Instantly share code, notes, and snippets.

@Sottti
Last active November 28, 2018 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sottti/e85a0c692b2366460b1528633256796f to your computer and use it in GitHub Desktop.
Save Sottti/e85a0c692b2366460b1528633256796f to your computer and use it in GitHub Desktop.
Kotlin Access Modifiers: private
// Private.kt file
// Visible just inside this file
private const val numberThree = 3
// Visible just inside this file
private class User() {
// Visible just inside the user class
private val numberEight = numberThree.plus(5)
}
// ERROR: numberEight is not accessible outside the User class
private const val numberEleven = numberEight.plus(numberThree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment