回调函数用法
来源:互联网 发布:dd for windows 用法 编辑:程序博客网 时间:2024/05/03 03:53
Callback的本质是设置一个函数指针进去,然后在需要需要触发某个事件时调用该方法。下面写个小例子加强理解
#include <iostream>using namespace std;typedef void (* callback)(const char *ch) ;void printfun(const char *ch) ;void fun(const char *name , callback cal) ;int main(){ char *name = "我喜欢C++!" ; fun(name , printfun) ; return 0 ;}void printfun(const char *ch){ cout<<ch<<"\n" ;}void fun(const char *name , callback cal){ cal(name) ;}
0 0
- 回调函数用法
- 回调函数用法
- 回调函数 用法
- 回调函数用法
- C++回调函数 用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法(
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- C++回调函数用法
- CTSC2016滚粗记 前篇
- Linux系统下在普通用户如何使用root权限
- 拜占庭将军问题深入探讨
- qsort()函数排序
- HDOJ(HDU) 2212 DFS(阶乘相关、)
- 回调函数用法
- 【复习笔记】 cocos2d-x 2.x 渲染特效实现 八 流光效果
- Unity3d+moba+草丛视野
- IE6-9不支持Textarea的maxlength属性
- 203. Remove Linked List Elements
- Linux系统下如何使用中文输入法
- Android系统Root原理初探——学习笔记
- Python_爬虫
- React-Native 十:版本升级