so, this is easiest to explain with code. but first: as to "why would you do that". i got a system where i can have an if loop once, and from then on just execute a variable containing the function which will gather information. this way i can add as many functions as i want wihtout compromising on performance. an external class (to reduce memory, it will be in a seperate class, only 30% of users will use this). needs to be able to acces those functions too, and while i am at it, i might just as well move all the functions to a seperate class, because i want this, no discussion possible.
now the introduction is done, here's a psuedo code example of what i want to do:
class datafactory { function createData() { } function createOtherData() { } // there are about 10-20 of these functions } class main extends WatchUi.WatchFace { var factory = new datafactory() function getRequiredFunction (value) { if (value == 1) { return method(:factory.createData); } else if (value == 2) { return method(:factory.createOtherData); } } }
that's roughly what i want to do. but when i do that, it says: could not find symbol "createData", or whatever the functionname is?
how should i do this?