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 5 1656
"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message
news:43***********************@news.sunsite.dk... 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,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message
news:43***********************@news.sunsite.dk... 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
Look at the delegates.
I hope this MSDN article could shed some light on the matter http://msdn.microsoft.com/library/de...estutorial.asp
--
Stoitcho Goutsev (100) [C# MVP]
"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message
news:43***********************@news.sunsite.dk... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dave Rahardja |
last post by:
OK, so I've gotten into a philosophical disagreement with my colleague at
work. He is a proponent of the Template Method pattern, i.e.:
class foo
{
public:
void bar() { do_bar(); }
protected:...
|
by: beyond |
last post by:
does anyone knows, how to encapsulate pl/sql-packages into DAO-object (java)?
we are considering to separate logic from data-structure in oracle.
what are the technical problems /risks doing...
|
by: Chris |
last post by:
Hi
I have a scenario where I've created another AppDomain to dynamically load a DLL(s) into. In this newly loaded DLL I want to call a static method on a class. The problem arise is that I have...
|
by: charliewest |
last post by:
this is a very newbie question re: oop - pls excuse my ignorance:
i have inserted in each of my asp.net web forms written using C# error
handing code that i would like to encapsulate in one,...
|
by: Matt |
last post by:
Hiding Method. How to Hide tx.carry()
I want tx.carry not to be reached on test();
any ideas?
public abstract class Car
{
public abstract void run();
public abstract void carry();
}
public...
|
by: TBass |
last post by:
Hi,
I've been using C for years, but I'm new to C++. For the most part it's
been smooth, but here's my current snag:
COPCClassFactor.h
===============
class COPCClassFactory
{
|
by: Jason Huang |
last post by:
Hi,
In my C# windows form, is it possible to encapsulate a Label to an Image?
If possible, how to do that?
Thanks for help.
Jason
|
by: kabradley |
last post by:
Hello everyone.
I have three reports that I would like to put into one main report. I tried creating the main report and then putting three seperate subreports in the detail section of the parent...
|
by: nw |
last post by:
Hi All,
I currently have a vector of objects (lets call them MyObject). I want
to perform various operations regularly on the whole vector, for
example find the maximum, average, or operations...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |