Type casts¶
open class Person(val name:String)
class Student(val grade:Int, val stuName: String):Person(stuName){
fun hungry(){
LogUtils.i(stuName,"I'm hungry.")
}
}
val a = cast<Person>(Student(6,"小明"))
open class Person(val name:String)
class Student(val grade:Int, val stuName: String):Person(stuName){
fun hungry(){
LogUtils.i(stuName,"I'm hungry.")
}
}
val a = cast<Person>(Student(6,"小明"))