Google did not help me with this question, I hope this does not mean that this is impossible:
In my class I want to have a method that has a signature but the body is not defined (method1)
There will be many specific methods that satisfy this signature (impl1, impl2, impl3)
When I initialize the object, I will then select (based on some criteria) which implementation of the impl1, impl2, impl3 method to assign to the function pointer method1
Basically, I ask how I can have a pointer to a function that can point to any function that satisfies its signature.
EDIT:
So it turns out that this is really very straightforward:
var method: Int => Int = (x => x+1)
method = (x => x-1)
method = (x => x*2)
etc...
My problem before was that I used "val" or "def" to define a "method"
, . , . , -, .
2: , , , , , "" , #.