回调函数

    技术2022-05-19  34

    // testAlg.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "windows.h" #include <iostream> using namespace std; typedef int(WINAPI *WNDCLASSBACK)(int *, int *); int __stdcall Call(int *a, int *b); class A { public: int Compare(int m, int n, WNDCLASSBACK function) { int *a = &m; int *b = &n; return (*function)(a, b); } }; int _tmain(int argc, _TCHAR* argv[]) { int a = 10; int b = 6; A m_a; cout << m_a.Compare(a, b, Call) << endl; return 0; } int CALLBACK Call(int *a,int *b) { return *a > *b ? (*a) : (*b); }


    最新回复(0)