函数指针数组的简单实现
来源:互联网 发布:淘宝店铺托管收费 编辑:程序博客网 时间:2024/06/10 14:29
</pre><pre name="code" class="cpp">#include <stdlib.h>#include<stdio.h>#include<iostream>#pragma pack(1)using namespace std;class qwe{public: qwe(); int add(int x,int y); int sub (int x,int y); int mov(int(*p)(int,int),int (*q)(int,int)); int (qwe::*fun[10])(int,int);};int qwe::add(int x,int y){return x+y;}int qwe::sub (int x,int y){ return x+y;}int qwe::mov(int (*p)(int,int),int (*q)(int,int)){int a=1;int b=2;a=p(a,b);b=q(a,b);return a+b;}qwe::qwe(){ // s=&qwe::mov; fun[0]=&qwe::add; fun[1]=&qwe::sub; (this->*fun[0])(2, 1);}int main(){ qwe* asd=new qwe(); int (qwe::*fun1[10])(int,int); fun1[0] = &qwe::add; int aaa=(asd->*fun1[0])(3, 1); cout << aaa<< endl; return 0;}
1 0
- 函数指针数组的简单实现
- 对指针数组,数组指针,函数指针数组,函数数组指针的一些简单理解
- 简单分析 指针数组 数组指针 函数指针 函数指针数组 指向函数指针数组的指针
- 函数指针数组的使用(简单)
- C++函数指针数组的简单使用
- 指针数组、数组指针、指针函数、函数指针的简单介绍
- 理解数组,结构 ,函数指针,指针函数,数组指针,指针数组,结构指针的定义和实现
- strcat,strcpy,strcmp,strlen4个常用字符串处理函数的数组与指针简单实现方法~
- strcat,strcpy,strcmp,strlen4个常用字符串处理函数的数组与指针简单实现方法~
- C语言用函数指针的数组简单实现计算器功能
- C语言——使用函数指针数组实现简单的计算器
- 函数指针,函数指针数组,函数指针数组的指针
- 函数指针,函数指针数组,函数指针数组的指针
- 函数指针,函数指针数组,函数指针数组的指针
- 函数指针、函数指针数组,函数指针数组的指针
- 指针数组 数组指针 函数指针 函数指针数组 指向函数指针数组的指针
- 理解 指针数组 数组指针 函数指针 函数指针数组 指向函数指针数组的指针
- 指针数组,数组指针,函数指针,函数指针数组,指向函数指针数组的指针
- Leetcode 111 Minimum Depth of Binary Tree
- 修改Nodejs内置的npm默认配置路径
- unused import statement解决方法
- java基础之异常
- apache多SSL证书虚拟主机使用mod_jk方式代理tomcat
- 函数指针数组的简单实现
- shell date命令
- RxJava初体验
- Jmeter连接SqlServer数据库进行压力测试
- 数据库学习笔记 --- SQL查询数据库中所有表中的字段名和字段类型
- 【剑指offer】替换空格
- 基础类库:Calendar类
- nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
- 无状态