kotlin-基础
holamP
Problems are not stop signs, they are guidelines.
展开
-
Kotlin 基础三:接口
接口跟java一样,接口是用interface关键字定义interface MyInterface { fun show() fun show2(){ // 方法体 }}//实现接口class InterfaceImp : MyInterface { override fun show() { }}覆盖冲突i...原创 2018-08-09 11:07:02 · 110 阅读 · 0 评论 -
Kotlin 基础二:类和继承
类和继承类Kotlin 中使用关键字 class 声明类class Person {...}构造函数一个类可以有一个主构造函数和一个或多个次构造函数 次构造函数:前缀有 constructor的,可以直接委托或者通过别的次构造函数间接委托。委托到同一个类的另一个构造函数用 this 关键字即可:class Person(var name: String) ...原创 2018-08-07 10:37:42 · 173 阅读 · 0 评论 -
Kotlin 基础一:关键字
kotlin语言中文站: http://kotlinlang.org/关键字 字段 说明 abstract 抽象声明,被标注对象默认是open annotation 声明一个注解类 by 委托 class 声明一个类 companion 声明一个伴生对象 const 将属性标记为编译期常量 c...原创 2018-08-07 15:29:33 · 145 阅读 · 0 评论