美文网首页KotlinAndroid
[WIP]Kotlin open Class是什么意思

[WIP]Kotlin open Class是什么意思

作者: 假装在去天使之城的路上 | 来源:发表于2018-07-06 11:50 被阅读12次
open class Base(p: Int)
class Derived(p: Int) : Base(p)

The open annotation on a class is the opposite of Java's final: it allows others to inherit from this class. By default, all classes in Kotlin are final, which corresponds to Effective Java, 3rd Edition, Item 19: Design and document for inheritance or else prohibit it.

The default visibility, used if there is no explicit modifier, is public.

相关文章

网友评论

    本文标题:[WIP]Kotlin open Class是什么意思

    本文链接:https://www.haomeiwen.com/subject/svmvuftx.html