首页 > 编程语言 > 详细

c++回调函数

时间:2017-10-30 16:46:03      阅读:217      评论:0      收藏:0      [点我收藏+]

C++使用回调函数的一种方法如下:

Example::Example() {}

Example::~Example() {}

int Example::Start() {
    auto callback = [this](const int type)->int {
        this->Callback(type);
        return 0;
    };

    xxx.ReginsterCallback(callback);
    return 0;
}

int Example::Callback(const int type) {
    /* do sth */
}

int main(int argc, char* argv) {
    Example ex;
    ex.Start();
}

 

c++回调函数

原文:http://www.cnblogs.com/cfox/p/7754856.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!