Creating and Handling Managed Events

Now that you understand the basics behind the use of delegates, you're going to explore the subject a little deeper to see how delegates can be used for event handling. For this lesson, a simple console application will be fine. Click New, Project from the File menu and create a new managed C++ application and name it ManagedEvents. Then click OK to create the project.

For this application, you will create two managed classes: the CSource class, which will be responsible for firing events, and the CSink class, which will catch and handle these events as they are fired. First, you'll work on the CSource class.

A class that is responsible for creating and firing events is known as the event source. To specify ...

Get Sams Teach Yourself Visual C++® .NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.