Skip to content

Instantly share code, notes, and snippets.

@Sottti
Last active December 15, 2018 09:52
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/e70447e11d722bd01f9b1689c95db08a to your computer and use it in GitHub Desktop.
Save Sottti/e70447e11d722bd01f9b1689c95db08a to your computer and use it in GitHub Desktop.
// Overridden.kt
public open class User {
protected open fun getAge() = 16
}
public class Moderator : User() {
// getAge() inherits the protected modifier as default
override fun getAge() = 18
}
public class Staff : User() {
// getAge() inherited protected modifier is overriden with public
public override fun getAge() = 21
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment