牵着老婆满街逛

严以律己,宽以待人. 三思而后行.
GMail/GTalk: yanglinbo#google.com;
MSN/Email: tx7do#yahoo.com.cn;
QQ: 3 0 3 3 9 6 9 2 0 .

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); 
        }

    }
;

posted on 2008-01-09 17:18 杨粼波 阅读(189) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理