Collection 定义如下
interface Collection<out E>: Iterable<E> {
val size: Int
fun isEmpty(): Boolean
// 剩下的定义
}
List 定义如下
interface List<out E>: Collection<E> {
override val size: Int
override fun isEmpty(): Boolean
// 剩下的定义
}
为何接口和抽象类在实现父接口时,有时候会手动 override 父接口的属性和方法呢?