QUOTE(Shuyin @ 3 Apr, 2008 - 05:50 AM)

Hello,
This is a lab question I'm unsure on.
I have a number of methods each performing a single operation on a number, for example : Switching a sign, applying a sine function or applying a square root.
If I wanted to perform something like the minus of the square root of a sine of a number then how would I replace all these methods with a single method which takes a parameter as a functor. I'm guessing the functor is another method with what we're applying to a number (like the example above)?
I could really do with some help here, thank you in advance :-)
Shuyin
Easy in C and C++ but not in Java. For security reason you do not want a malicious user or hacker to pass on a custom made function/method to another function expecting one of the standard functions/method.
As there is no arithmetic on pointers in Java there are no pointer to method in Java.
This post has been edited by pbl: 3 Apr, 2008 - 05:12 AM