abstract class Gun(val range: Int) {
abstract fun pullTrigger(): String
protected fun doSomething() {
}
}
//接口里面有必须要实现的接口 或者不需要强制实现的方法
class AK47(val price: Int) : Gun(range = 500) {
override fun pullTrigger(): String {
doSomething();
return ""
}
}
Kotlin 抽象类 abstract
猜你喜欢
转载自blog.csdn.net/mp624183768/article/details/123932130
今日推荐
周排行