kotlin open

作者: Smallmeng | 来源:发表于2018-06-20 15:27 被阅读0次

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.

若类想要被继承,需要增加open修饰字符,kotlin中类默认不可继承

相关文章

网友评论

    本文标题:kotlin open

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