I've written some calculate delegates which are passed as parameters.
private delegate int CalculateDelegator(int value1, int value2);
CalculateDelegator addWith = add;
CalculateDelegator divWith = div;
private static int add(int value1, int value2) {
return value1 + value2;
}
private static int div(int value1, int value2) {
return value1 / value2;
}
The method link(CalculateDelegator method, int value2)
which receives addWith
as parameter holds value1 and the method which calls link
holds value2. So I call link() always with passing value2 as seperate paremeter.
Is there a way of passing the calculating method including the first parameter: link(addWith(value2))
?
(e.g. as a partial function like in Scala)