Okay, for reasons best understood by myself, I attempted to create delegates under C++ (no templates because, frankly, they just make an ugly language look uglier). I managed to hack something that worked, but have grave concerns that it is incorrect.
I was right.
In his article The Gang Of Four Is Wrong And You Don’t Understand Delegation, Jim Gay goes through what we THINK delegation is and what delegation REALLY is.
And he is right.
I spend a lot of time in Objective C. I love Objective C. It makes OOP fun. In Objective C you can do true delegation. It isn’t a hack, it is part of the language.
C++ is a lot like Darth Vader. It is the dark side. You don’t program in C++, C++ programs you (as they say in Russia). C++ is the program of “no”. NO you can’t have delegates. NO you can’t do that (because I arbitrarily said so). The list of No’s goes on and on. Why have people flocked to C#? It is less “no’ish”.
Other than that, it’s not bad. Perhaps one day I’ll write a book titled “C++ – The Good Parts” on how to write readable, useable, and most important, fun C++.
Rather than summarize a summation of a long article, read Gay’s article. It won’t take long. You will learn something important.