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 1675
"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REM OVE> wrote in message
news:43******** *************** @news.sunsite.d k... 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@<REM OVE> wrote in message
news:43******** *************** @news.sunsite.d k... 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@<REM OVE> wrote in message
news:43******** *************** @news.sunsite.d k... 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:
virtual void do_bar() {}
};
|
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 this?
are there other options?
|
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 the same class/static method definition statictly linked to my EXE and when I call InvokeMember(...), even though I got the Type from the new AppDomain, it calls the static method that I am staticly linked to and not the static method in the dynamicly...
|
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, centralized class.
However, all of the examples i find regarding the usage of classes deal w/
inheritance.
my question is: is there a way to simply refer to methods in separate .cs
files, w/out having to use inheritance? it seems inefficient to...
|
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 class Taxi : Car
{
| |
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 report, but the page headers in the subreports do not print. After searching, I learned that the reason for this is because subreports do not have anything except group headers/footers and report headers/footers. I then set the record source of the...
|
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 not dissimilar to
that. So as I see it I have 3 options:
1. Implement these operations as functions
2. Derive a class from vector (from googling people seem to think this
is a bad idea)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |