托管实力

来源:互联网 发布:庖丁解牛中乎 编辑:程序博客网 时间:2024/04/30 05:07

// test.cpp : 定义控制台应用程序的入口点。
//
#include <tchar.h>
#include <iostream>
#include "entrust.h"

using namespace std;

typedef nsKLIB::tentrust<int, char*, bool> TEntrust;

bool CALL_ENTRUST func(int, char*)
{
 wcout << L"func();" << endl;
 return true;
}

class TObj
{
public:
 bool CALL_ENTRUST func(int, char*)
 {
  wcout << L"TObj::func();" << endl;
  return true;
 }
 
 static bool CALL_ENTRUST static_func(int, char*)
 {
  wcout << L"TObj::static_func();" << endl;
  return true;
 }

};

int _tmain(int argc, _TCHAR* argv[])
{
 TObj obj;

 TEntrust gentrust(&func),
  mentrust(&obj, &TObj::func),
  sentrust(&TObj::static_func);

 bool ret = gentrust(0, 0);
 ret = mentrust(0, 0);
 ret = sentrust(0, 0);

 return cin.get();
}