Execute a string as a method?
How to execute a string as a method?
rod178:
How to execute a string as a method?
if(methodString== "MyMethod()") MyMethod();
GumRai:
Not the solution I was looking for
I desire to enter the methods dependent on variable values created. This would include overloading.
angevoyageur:
You then have to use OOP and pointers.
You then have to use OOP and pointers.
Yes, that is an option, although I was hoping that a more direct approach was available, as is in some other languages.
eg
eval 'MyMethod()' # Ruby code to execute a method from a string
rod178:
Unfortunately not.
Yes, that is an option, although I was hoping that a more direct approach was available, as is in some other languages.
eg