Re: Calling a method



In article <Q8adnTn68-5TSPrfRVn-oQ@xxxxxxxxxxx>, jm1@xxxxxxxxxxxx enlightened
us with...
> Here's another thing I'm trying to do that I hope someone can help with.
> I'd like to call a method on an instance of a class using a string as
> the method name. Something like anInstance.perform("getName"), which
> would call the method getName() on the instance and return the value
> from that.
>
> Any ideas on that?

You have to use reflection to do that sort of thing. There's nothing as
simple as just one line of code for it (like javascript and asp have), no.
Here are a couple options.
http://mindprod.com/jgloss/eval.html

--
--
~kaeli~
If a book about failures doesn't sell, is it a success?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

.



Relevant Pages

  • Re: How to generate a Windows style license key
    ... I put them on a CD and sell them on the corner for $4 ... adobe, pgp) that initially never made money for a long time, ... the factor for success does not depend whether the ... for the SAME PRICE. ...
    (sci.crypt)
  • Re: Question about lulu.com
    ... I managed to sell a couple thousand copies of Monster Hunter ... It won't matter because the ... try to do anything other than self publishing. ... absurdly hard to have success. ...
    (rec.arts.sf.composition)
  • Sony Vaio GRT Series.
    ... I wanted to give an update of what i've found (successes & failures) ... a clean install & work correctly. ... Success: DUAL BOOT. ... Success: DISPLAY ...
    (comp.os.linux.networking)
  • Sony Vaio GRT Series.
    ... I wanted to give an update of what i've found (successes & failures) ... a clean install & work correctly. ... Success: DUAL BOOT. ... Success: DISPLAY ...
    (comp.os.linux)
  • Re: Writing what you want
    ... amount of money and renown based on the merits of the art. ... the success of the art is due to the success of ... which is a claim that products make the song popular. ... If some people who sell their music don't sell out and some people do ...
    (rec.arts.sf.written)