我有这个界面:
// Interface for any simulation that is integrated against dt
interface SimulationState {
fun integrate(totalTime: Long, deltaTime: Long) : SimulationState
fun interpolate(alpha: Double, previousState: SimulationState) : SimulationState
fun preRender() : Collection<Pair<Int, Int>>
}
在这种情况下,实现与我的问题无关。问题是我可以覆盖子类型中的函数类型吗?下面是一个示例,该示例无法编译;因此,我提出这个问题的原因。
interface ShipState : SimulationState {
// Still in abstract, just hope I can somehow override the function type...
override fun integrate(totalTime: Long,
deltaTime: Long,
asteroidVectors: Collection<Pair<Double, Double>>) : SimulationState
}
希望上面公认的未编译代码能清楚表明我的意图。Java / Kotlin是否可能?如果是这样,我将如何处理?
蛊毒传说
回首忆惘然
相关分类