On Kotlin, Arguments of a function require their type annotation when defining the method.
In my case, I have two classes from an interface.
interface Base{
fun method()
}
class DervA():Base{
fun override method(){
...
}
}
class DervB():Base{
fun override method(){
...
}
}
And, I hope to call their methods from other function like
fun test_method(inst){
inst.method()
}
But, Kotlin compiler complains "a type annotation is required on a value parameter" .
Should I define "test_method" for each of the classes ?
fun test_method_for_DervA(inst:DervA){
inst.method()
}
fun test_method_for_DervB(inst:DervB){
inst.method()
}
Do you have any smarter way for it?