c++call back
#include "stdafx.h"
struct A; typedef void(A::*MemFuncPtr) (int* e); class A
{
int a;
}; class View : public A
{
public:
virtual void test() { printf("test A\n"); }
}; class Window : public View
{
public:
virtual void test() { printf("test A\n"); }
void func(int * b) { (void)b; printf("************\n"); }
}; typedef void(*HandlerNoParam)();
typedef void(*Handler1Param)(void* receiver);
typedef void(*Handler2Param)(void* receiver, int* e); void test1()
{
printf("no parameter test:\n");
} void test2(void* receiver)
{
(void)receiver;
printf("1 parameter test:\n");
} void test3(void* receiver, int* e)
{
(void)receiver;
(void)e;
printf("2 parameter test:\n");
} int _tmain(int argc, _TCHAR* argv[])
{
Handler2Param p0 = (Handler2Param)test2;
p0(NULL, ); MemFuncPtr p = (MemFuncPtr)&Window::func;
Window a;
(a.*p)(NULL);
getchar();
return ;
}
随机推荐
- HTTP 缓存之ETag 和Cache-Control的使用方法介绍
什么是http缓存,有什么作用 通过网络获取内容既速度缓慢又开销巨大.较大的响应需要在客户端与服务器之间进行多次往返通信,这会延迟浏览器获得和处理内容的时间,还会增加访问者的流量费用.因此,缓存并重复 ...
- [leetcode tree]104. Maximum Depth of Binary Tree
求树的最大深度 class Solution(object): def maxDepth(self, root): if not root: return 0 left = self.maxDepth ...
- Standard NSD file
%pool: pool=system blockSize=256K layoutMap=cluster allowWriteAffinity=no %pool: pool=datapool block ...
- python opencv3 矩形 圆形边框
git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 读入图像 ...
- LINUX按键驱动程序
<<混杂设备驱动模型>> <混杂设设备的描述> <混在设备的概念> 在linux系统中,存在一类字符设备,他们拥有相同的主设备号(10),但是次设备号不 ...
- 【BZOJ 1419】1419: Red is good (概率DP)
1419: Red is good Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 807 Solved: 343 Description 桌面上有R张 ...
- BZOJ.2194.快速傅立叶之二(FFT 卷积)
题目链接 \(Descripiton\) 给定\(A[\ ],B[\ ]\),求\[C[k]=\sum_{i=k}^{n-1}A[i]*B[i-k]\ (0\leq k<n)\] \(Solut ...
- 谁是最快的Go Web框架
根据Julien Schmidt测试框架中测试到的go web框架,在加上lion,fasthttp,一共测试了下面的web框架. default http macaron go-json-rest ...
- windows提权exp列表
漏洞列表 #Security Bulletin #KB #Description #Operating System CVE-2017-0213 [Windows COM Elevation of P ...
- spring---aop(10)---Spring AOP中AspectJ
写在前面 在之前的文章中有写到,Spring在配置中,会存在大量的切面配置.然而在很多情况下,SpringAOP 所提供的切面类真的不是很够用,比如想拦截制定的注解方法,我们就必须扩展DefalutP ...