How to call method by variable?

Ralf Bokelberg squeak at bokelberg.de
Sat Jan 18 14:22:56 UTC 2003


This surely has been answered already, 
but i couldn't find it, sorry. 

I want to call a method of an object, 
whose name is in a variable. 

The following script is not correct, 
but it shows (hopefully) my intention. 

meth1
    Transcript show: 'meth 1 called'.

meth2
    Transcript show: 'meth 2 called'.

initialize
    actMeth _ meth1

step 
    "I want to call the method which is in actMeth"
    self actMeth. 

How can this be done ? 

Kind regards,
bokel



More information about the Squeak-dev mailing list