Simple effective Event/Delegate Method in c++
C++ delegate/event Callback class (base class) : if return Type is void template <typename Param0> class Callback { public: virtual void invoke(Param0 param0) = 0; }; the Param0 type is the type of the one parameter passed to the function. You can use more than one parameter to pass by using template <typename Param0, typename Param 1 > then invoke method will be replaced by virtual void invoke(Param0 param0, Param1 param1) = 0; now if return type is not void then class will be defined as template <typename Ret, typename Param0> class Callback { public: virtual Ret invoke(Param0 param0) = 0; }; The Ret is the return type of the function. Member function (method) callback (Derived Class) : Member function (method) callbacks keep track of which object address to use for the this pointer while invoking the method. when return type is void template <typename Param0, typename Object, typename Method> class MethodCallback