christian.steffensen
03/14/2019, 8:52 AMclass StartViewModel() : BaseViewModel() {
sealed class Input : IInput {
object ButtonClicked : Input()
}
override fun handleInput(input: IInput) { //I want this to be of the type Input, instead of the interface
}
}
abstract class BaseViewModel {
interface IInput
protected abstract fun handleInput(input: IInput)
init {
handleInput(something that implements IInput)
}
}
skoric
03/14/2019, 9:18 AMclass StartViewModel() : BaseViewModel<StartViewModel.Input>() {
sealed class Input : IInput {
object ButtonClicked: Input()
}
override fun handleInput(input: Input) {
}
}
abstract class BaseViewModel<T : BaseViewModel.IInput> {
interface IInput
protected abstract fun handleInput(input: T)
}
christian.steffensen
03/14/2019, 10:03 AM