Encapsulate a method...

  • Thread starter Thread starter Thorbjørn Jørgensen
  • Start date Start date
T

Thorbjørn Jørgensen

Hi
How can I encapsulate a specific method from a specific object? I have some
different object with different methods, and I would like that the object
could put a reference to one of its methods into a common arraylist. A
control element should then at a later time, go through the arraylist and
execute the methods, but I do not know how to encapsulate the methods to put
then into the arraylist?

Hope that my question is somehos understandable, and that someone can
help...

Regards
Thorbjørn
 
Thorbjørn Jørgensen softdoc.dk> said:
Hi
How can I encapsulate a specific method from a specific object? I have
some different object with different methods, and I would like that the
object could put a reference to one of its methods into a common
arraylist. A control element should then at a later time, go through the
arraylist and execute the methods, but I do not know how to encapsulate
the methods to put then into the arraylist?

Look into delegates.
 
Hi,

You can use an array of delegates ( or a ArrayList if the number of element
change) .

cheers,
 
Back
Top