Hi,
I'm using two form classes and I would like all methods of the second class
(the child class) to be managed by the first class (the main class).
Is delegation the best solution for me?
If so, how can I define delegation?
--
Thanks,
Mayer 5 1451
If you inherit child from main you will get all main methods automatically
in child, if I got your question right.
Why do you mention delegation? Do you have some specific example in mind
which made you consider delegation?
"Mayer" <me*********@dd s-security.com.do notspamwrote in message
news:E2******** *************** ***********@mic rosoft.com...
Hi,
I'm using two form classes and I would like all methods of the second
class
(the child class) to be managed by the first class (the main class).
Is delegation the best solution for me?
If so, how can I define delegation?
--
Thanks,
Mayer
Mayer wrote:
I'm using two form classes and I would like all methods of the second class
(the child class) to be managed by the first class (the main class).
Is delegation the best solution for me?
No. Inheritance would be the way to go.
Have Second inherit from First and both will do exactly the same thing
until you start overriding and changing Second.
If so, how can I define delegation?
Delegate methods (known in other languages as Function Pointers) are a
way for you to call a method at run-time without knowing anything about
it at compile time, other than it has a given signature.
Event handlers are all delegates under the covers - the Control that
raises the event (and calls your Event Handler [delegate] method) knows
nothing whatever about your class and yet it can still call your method!
HTH,
Phill W.
Hi Alex,
Thank you for your answer.
My case is as follows:
The main form, opens the child form, nothing to do with inheritance.
I odn't want to dispose the inner class, the child. It means, instead of
calling childForm.fillC olor, I prefer to activate mainForm.FillCo lor which
activates the inner private fillColor.
Is delegate the best solution?
--
Thanks,
Mayer
"AlexS" wrote:
If you inherit child from main you will get all main methods automatically
in child, if I got your question right.
Why do you mention delegation? Do you have some specific example in mind
which made you consider delegation?
"Mayer" <me*********@dd s-security.com.do notspamwrote in message
news:E2******** *************** ***********@mic rosoft.com...
Hi,
I'm using two form classes and I would like all methods of the second
class
(the child class) to be managed by the first class (the main class).
Is delegation the best solution for me?
If so, how can I define delegation?
--
Thanks,
Mayer
I believe that depends how you define "best"
If that's one property you can just call child property from code handling
change of main form property. No need for delegation.
If you want to implement this functionality for all properties of child
form, you need to look into reflection (see PropertyInfo.Se tValue at http://msdn2.microsoft.com/en-us/lib...ue(VS.71).aspx)
Again, I don't see the need for delegation. You can add method to child,
which could be called with property name and new value.
However, even in this case I would consider inheritance and put property
change handling method into base class (for child), in case you might need
different children with same behavior.
Does this answer your question?
"Mayer" <me*********@dd s-security.com.do notspamwrote in message
news:22******** *************** ***********@mic rosoft.com...
Hi Alex,
Thank you for your answer.
My case is as follows:
The main form, opens the child form, nothing to do with inheritance.
I odn't want to dispose the inner class, the child. It means, instead of
calling childForm.fillC olor, I prefer to activate mainForm.FillCo lor which
activates the inner private fillColor.
Is delegate the best solution?
--
Thanks,
Mayer
"AlexS" wrote:
>If you inherit child from main you will get all main methods automaticall y in child, if I got your question right.
Why do you mention delegation? Do you have some specific example in mind which made you consider delegation?
"Mayer" <me*********@dd s-security.com.do notspamwrote in message news:E2******* *************** ************@mi crosoft.com...
Hi,
I'm using two form classes and I would like all methods of the second
class
(the child class) to be managed by the first class (the main class).
Is delegation the best solution for me?
If so, how can I define delegation?
--
Thanks,
Mayer
Yes, thank you very much.
--
Mayer
"AlexS" wrote:
I believe that depends how you define "best"
If that's one property you can just call child property from code handling
change of main form property. No need for delegation.
If you want to implement this functionality for all properties of child
form, you need to look into reflection (see PropertyInfo.Se tValue at http://msdn2.microsoft.com/en-us/lib...ue(VS.71).aspx)
Again, I don't see the need for delegation. You can add method to child,
which could be called with property name and new value.
However, even in this case I would consider inheritance and put property
change handling method into base class (for child), in case you might need
different children with same behavior.
Does this answer your question?
"Mayer" <me*********@dd s-security.com.do notspamwrote in message
news:22******** *************** ***********@mic rosoft.com...
Hi Alex,
Thank you for your answer.
My case is as follows:
The main form, opens the child form, nothing to do with inheritance.
I odn't want to dispose the inner class, the child. It means, instead of
calling childForm.fillC olor, I prefer to activate mainForm.FillCo lor which
activates the inner private fillColor.
Is delegate the best solution?
--
Thanks,
Mayer
"AlexS" wrote:
If you inherit child from main you will get all main methods
automatically
in child, if I got your question right.
Why do you mention delegation? Do you have some specific example in mind
which made you consider delegation?
"Mayer" <me*********@dd s-security.com.do notspamwrote in message
news:E2******** *************** ***********@mic rosoft.com...
Hi,
I'm using two form classes and I would like all methods of the second
class
(the child class) to be managed by the first class (the main class).
Is delegation the best solution for me?
If so, how can I define delegation?
--
Thanks,
Mayer
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rene Pijlman |
last post by:
Section 6.5 "What is delegation?" of the FAQ says:
"Python programmers can easily implement delegation. For example, the
following class implements a class that behaves like a file but converts
all written data to uppercase:
class UpperOut:
def __init__(self, outfile):
self.__outfile = outfile
def write(self, s):
|
by: Jacob |
last post by:
Hello All,
I am trying to serve out some content via IIS that is hosted on a
remote fileserver, and am unable to get the delegation working
correctly. Our setup is as follows:
Local LAN
Windows 2000 domain (mixed-mode): MYDOMAIN (mydomain.net)
Windows 2003 Server w/IIS6: WEB01
Windows 2000 Server hosting files: FILE01
Windows XP Pro client workstation: CLIENT01
|
by: DPfan |
last post by:
Is the following so-called "delegation"? If not how to make some changes so
that the F class delegates its operation to an E instance.
On the other hand the following code runs without any problem. Is there any
potential problems with it?
class E
{
public:
void Draw_E(int a, int b) { cout << "Draw in E " << a*b<< endl; }
|
by: Tony Johansson |
last post by:
Hello!
What does it mean with delegation and can you give me one example.
//Tony
|
by: |
last post by:
Hi,
I am working on a n-tier app using remoting. I am using the VS 2005 beta
2. My server needs to access a remote resources on behalf on the connected
user.
I have configured my server like :
<channel ref="tcp" secure="true" port="8081" impersonate="true">
and my client:
<channel ref="tcp" port="0" secure="true"
| |
by: russell.lane |
last post by:
I'm building out a pretty standard n-tier web application. The stack
includes application/presentation, biz logic, and data access layers on top
of an SQL server back end.
We want to use impersonation and delegation to forward the user's Windows
login through all layers in the stack. To support this, I'm setting up a
set of domain accounts which we use to create SPNs for the various services
in the various layers.
At this point, I'm...
|
by: JimLad |
last post by:
In advance, sorry if this is the wrong group...
SQL Server 2000 SP3 on Server 2003. SQL Account and Computer both
Trusted for Delegation. Given SPN.
IIS 5.0 on W2000. Kerberos enabled. Computer Trusted for Delegation.
Integrated Windows Authentication selected. Medium pooled. Not the
default website - using IP address to connect from client.
IWAN_<computernamelocal account is running as part of operating
system and trusted for...
|
by: Marc Castrechini |
last post by:
This is a classic double hop delegation issue, however its the first time we
are setting this up so we are doing something incorrectly. If we run
through the IDE or using a localhost path on the web server the command
succeeds. However, if we use the servername or ip through IIS it fails.
For this reason we know we have permissions setup correctly on the file
server.
Can anyone identify what we could possibly be doing wrong here:
...
|
by: Patrick |
last post by:
Hello
I have the following scenario
- SQL 2005 server (serversql)
- Windows 2003 with IIS (serveriis)
- Windows 2003 ADS (serverads)
I want to connect to an intranet application using NTML with impersonation
and delegation. so for this I made the following change in web.config
<identity impersonate="true"/>
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |