A delegate is a pointer to a function in managed C++. Its just like a callback funciton pointer in traditional C++, but more powerful as it deals with the complexity issues and if you want allows you to assign several functions to be called in a single delegate.

Avoiding Using Delegates

You can pass objects to other classes / objects which they can then store and call functions of that object. For instance if you want a function to be called by lots of different classes, say to store log events, then simply create it a a class, declare it in the ap’s main class and pass a handle to it to the constructors of classes / objects you want to be able to all it. It works and is much easier than delegates!

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *