Visual C++ .NET is smiling to you, please return her smile

The C++ Programming Tutorials: The Delegates and Events







Delegates and events are extremely powerful and important constructs in the Microsoft .NET Framework. Events in particular are used widely in GUI programs as a means of communicating between components, but both delegates and events can be used to good effect  in non-GUI code. Delegates are the .NET equivalent of function pointers, and they can be created and used from any .NET language.

They can be used by themselves, and they also form the basis for the .NET event mechanism discussed in the second part of this module. A delegate is a class that lets you invoke one or more methods that have a particular signature. Events provide a formalized, standard mechanism that lets event sources (such as a button) hook up with event receivers (such as a form). Events in the .NET Framework implement a publish-and-subscribe mechanism, where event sources make public the events that they will raise, they publish them and event receivers tell the source which events they’re interested in, they subscribe to events. Event receivers can also un-subscribe when they no longer want to receive a particular event. You will also find the DLL program example for C++ .NET in this tutorials. Moreover you will also learn how to set the library files and include file paths for the Windows Platform SDK in your VC++ .NET project so that compiler can find them during the compilation and liking. The following are the topics for this Chapter.

  1. C++ Delegates & Events 1: What Are Delegates?, What Are Function Pointers?, What Do Delegates Do?, Defining Delegates and Implementing Delegates

  2. C++ Delegates & Events 2: Calling Non-Static Member Functions Using Delegates and Using Multicast Delegates

  3. C++ Delegates & Events 3: What Are Events?, Implementing an Event Source Class, How Does the event Keyword Work?, Implementing an Event Receiver, Hooking It All Together and Quick Reference



  5. C++ Delegates & Events 4: More on Delegates and Events, Managed Extensions for C++: the __delegate keyword, Managed C++ .NET: the delegate keyword

  6. C++ Delegates & Events 5: The Unbound Delegates

  7. C++ Delegates & Events 6: More on Defining and Using Delegates, Associating Delegates to Members of a Value Class, Associating Delegates to Unmanaged Functions and Composing Delegates

  8. C++ Delegates & Events 7: Passing a Delegate^ to a Native Function Expecting a Function Pointer and The Generic Delegates (C++)




Best viewed using FireFox, Chrome etc. Worst viewed using IE of any version


Webmaster contact: [contact[@]]

Copyright 2019 © Visualcplusdotnet. All rights reserved.

Excellent hosting services provided by MochaHost - The Online Central



| About | Disclaimer | Privacy | Site Index & Project Download | Native C | Contact |



Custom Search