Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6534727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:17:10+00:00 2026-05-25T10:17:10+00:00

Whats the difference between bound and unbound delegates? heres how you create delegates of

  • 0

Whats the difference between bound and unbound delegates?

heres how you create delegates of both types:

// bound delegate declaration
public delegate void Handler(int value);
// create a bound delegate
Handler^ handler = gcnew Handler(HandlerClass::Fun1);

// unbound delegate declaration
public delegate void UBHandler(ThisClass^, int value); 
// create an unbound delegate
UBHandler^ ubh = gcnew UBHandler(&ThisClass::Sum); 

these are nearly the same. then, you can create constructors for bound delegates that consist of two parameters:

HandlerClass^ obj = gcnew HandlerClass;
Handler^ handler2 = gcnew Handler (obj, & HandlerClass::Fun3);

it means that you can use this particular delegate to invoke a function that is not static (is an instance). but then you can do the same with unbound delegates. Here’s how you might call the ubh delegate:

ThisClass^ obj = gcnew ThisClass(99.0);
ubh(obj, 5);

so whats the point of having both types?

// code for HandlerClass
public ref class HandlerClass
{
  public:

  static void Fun1(int m)
  { Console::WriteLine(L”Function1 called with value {0}”, m); }
  static void Fun2(int m)
  { Console::WriteLine(L”Function2 called with value {0}”, m); }
  void Fun3(int m)
  { Console::WriteLine(L”Function3 called with value {0}”, m+value); }
  void Fun4(int m)
  { Console::WriteLine(L”Function4 called with value {0}”, m+value); }

  HandlerClass():value(1){}
  HandlerClass(int m):value(m){}

  protected:

  int value;
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:17:10+00:00Added an answer on May 25, 2026 at 10:17 am

    The difference is the exact time the target object value is generated. With a bound delegate it is generated when you create the delegate object and it is forever unchanging after that. An unbound delegate doesn’t store the object reference, it is generated at the time the delegate is invoked. The same delegate can then be used to invoke the target method with different objects.

    Unbound delegates are a match with the syntax of C++ member function pointers. There is no direct equivalent for bound delegates in C++.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

delegate void DelegateTest(); DelegateTest delTest; Whats the difference between calling delTest.Invoke() and delTest() ?
Whats the difference between this: @property (nonatomic, weak) id <SubClassDelegate> delegate; and this: @property
Whats the difference between: @interface SomeClass : NSObject { NSObject *something; } and @interface
Whats the difference between Cast & Convert in C# 2008?
Whats the difference between SELECT DISTINCT field1 FROM table1 cd JOIN table2 ON cd.Company
Whats the difference between Url.Action and Html.RenderActionLink in asp.net mvc?
Duplicate Whats the difference between declaring as new and as something new something i
I would like to ask whats the difference between for row in session.Query(Model1): pass
As the title says, whats the difference between MyFunction = function() { } and
With regards to SQL and queries, whats the difference between an in-memory table, temp

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.