Delegates in C++

Delegates in C++

Delegates are function pointer containers that are used as a generic form of holding function pointers.
   template < class  T >
    
class  ZDelegate
    
{
    
public:
        List
<T> functionList;
        
void operator += (T h)
        
{
            
if(!functionList.Contains(h))
                functionList.AddItem(h); 
        }

 
        
void operator -= (T h)
        
{
            
if(functionList.Contains(h))
               functionList.RemoveItem(h); 
        }

    }
;

你可能感兴趣的:(Delegates in C++)