Last active
December 3, 2018 07:11
-
-
Save Sottti/91dc0f7bf60ac7581b012ea401ca21d0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Protected.kt file | |
// Visible inside this file | |
private const val numberThree = 3 | |
// Visible inside this file | |
private open class User() { | |
// Visible inside the User class and subclasses | |
protected val numberEight = numberThree.plus(5) | |
} | |
// Visible inside this file | |
private class Moderator() : User() { | |
// Visible inside the Moderator class | |
// numberEight is visible because Moderator is a subclass of User | |
private val numberEleven = numberThree.plus(numberEight) | |
} | |
// ERROR: protected modifier is not allowed for top level declarations | |
protected const val numberThree = 3 | |
// ERROR: protected modifier is not allowed for top level declarations | |
protected class Staff() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment