//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop #include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1; class CAppleDemo
{
public:
CAppleDemo();
~CAppleDemo(); void fun1(void); void fun2(int a, int b); int fun3(int a);
}; #include <iostream> CAppleDemo::CAppleDemo()
{
// std::cout << "CAppleDemo::CAppleDemo()" << std::endl;
} CAppleDemo::~CAppleDemo()
{
// std::cout << "CAppleDemo::~CAppleDemo()" << std::endl;
} void CAppleDemo::fun1(void)
{
ShowMessage( "CAppleDemo::fun1()" );
} void CAppleDemo::fun2(int a, int b)
{
ShowMessage( "CAppleDemo::fun2() a="+(String)a+",b="+(String)b );
} int CAppleDemo::fun3(int a)
{
ShowMessage( "CAppleDemo::fun2() a="+(String)a); return a; } template<typename dst_type, typename src_type>
dst_type pointer_cast(src_type src)
{
return *static_cast<dst_type*>(static_cast<void*>(&src));
} template<typename dst_type, typename src_type>
dst_type union_cast(src_type src)
{
union{
src_type s;
dst_type d;
}u;
u.s = src;
return u.d;
} typedef void (__fastcall *FunFun1)(void* pThis, int edx);
typedef void (__fastcall *FunFun2)(void* pThis, int edx, int a, int b);
typedef int (__fastcall *FunFun3)(void* pThis, int edx, int a); typedef void (__fastcall *FunFunMain)(void* pThis, TObject *Sender); //---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender)
{
// CAppleDemo cAppleDemo; // FunFun1 fun1 = pointer_cast<FunFun1>(&CAppleDemo::fun1);
// FunFun2 fun2 = pointer_cast<FunFun2>(&CAppleDemo::fun2);
// FunFun3 fun3 = union_cast<FunFun3>(&CAppleDemo::fun3); // fun1(NULL, NULL);
// fun2(NULL, NULL, 11, 22);
// fun3(NULL, NULL, 33); FunFunMain pM = union_cast<FunFunMain>(&TForm1::Button1Click);
pM(NULL,Sender);
}
//--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender)
{
ShowMessage("Button1Click");
}
//---------------------------------------------------------------------------

最新文章

  1. windows 共享文件夹 给 mac
  2. web app性能大讨论
  3. C2第十次解题报告
  4. 用Linux命令wget进行整站下载
  5. TCP相关知识
  6. [Client]动检参数讨论与ONVIF
  7. pure学习笔记
  8. iOS开发的一些奇巧淫技(转载)
  9. echo 0000
  10. 使用Java实现二叉树的添加,删除,获取以及遍历
  11. net core体系-web应用程序-4asp.net core2.0 项目实战(1)-5项目数据库操作封装操作-EF框架
  12. php中__call() 和 __callStatic方法的使用
  13. pycharm 配置服务器,脚本,测试文件
  14. HttpClient和HttpGet 参数的优先级
  15. SSM框架搭建问题
  16. 快速沃尔什变换 FWT 学习笔记【多项式】
  17. 20155316 2016-2017-2 《Java程序设计》第2周学习总结
  18. Linux内核分析7
  19. SharedPreferences小技巧
  20. HLJU 1042 Fight (种类并查集)

热门文章

  1. (java 实现开箱即用基于 redis 的分布式锁
  2. [常用工具] 深度学习Caffe处理工具
  3. Java开发学习(五十)----MyBatisPlus快速开发之代码生成器解析
  4. 焦距的物理尺度、像素尺度之间的转换关系以及35mm等效焦距
  5. [Leetcode]移除链表元素
  6. AtCoder Beginner Contest 282 G - Similar Permutation
  7. 读Java8函数式编程笔记06_Lambda表达式编写并发程序
  8. activemq插件在eos中的开发
  9. 将Grafana嵌入自己的应用
  10. C#DataTableRow列值互转