Is there any way to declare a functional object wi...
# getting-started
m
Is there any way to declare a functional object with parameterized
invoke()
? e. g.
Copy code
class SomeAction : ()->?!?!? {
    override fun invoke <T> (): T {
        return ...
    }
}
t
miha-x64:
Copy code
class SomeAction<T> : () -> T {
    override fun invoke(): T {
        
    }
}
m
This is a parameterized class. I ended up using this, but I want parameterized method 🙂
t
ah, ok. You can also do this.
Copy code
class SomeAction {
    operator fun <T> invoke(): T {

    }
}
You can not extend from ()->? AND get a parameterised method at the same time though.
k
I had the same problem once and didn't find a satisfying answer