C/C++函数实现接口

来源:互联网 发布:js获取系统时间 编辑:程序博客网 时间:2024/06/10 15:52
#include"iostream"using namespace std;typedef void(*pfun)();void fun1(){    cout<<"this is 1"<<endl;}  void fun2(){    cout<<"this is 2"<<endl;}//函数接口void funs(pfun p){    (*p)();}int main(){    funs(fun1);    funs(fun2);    return 1;}

0 0
原创粉丝点击