Skip to content

Instantly share code, notes, and snippets.

@Sottti Sottti/Overridden.kt
Last active Dec 15, 2018

Embed
What would you like to do?
// 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
You can’t perform that action at this time.