Suppose I have a function which resides in the fn
property of the following Method
struct:
type Method struct {
fn interface{}
}
var inst = &Method{func(a, b int) int {
return a + b
}}
Now, I want to invoke this function with two arguments
without explicitly casting it to func(int, int) int
like
so
a := 5
b := 6
fmt.Println(inst.fn(a, b))
How can I achieve this? Is there some generic solution for this?