看了qualcomm的 interface, 决定把它抄下来。 主要还是方便日后查找。
1. define the structure of virtual function table
2. define the structure of "class"
3. about the size of structure
1) size of virtual function table
4 bytes
2) size of member variable
0xxxxx --> original address
0xxxxx --> virtual table 4B
0xxxxx --> member 1
0xxxxx --> member 2
0xxxxx --> member 3
4. initialization of stucture.
1) use static global virtual table.
2) use dynamic virtual table
CMyFunc *pMe = (CMyFunc *) MALLOC(sizeof(CMyFunc)+sizeof(AEEVTBL(IMyFunc)));
0xxxxx --> original address
0xxxxx --> virtual table 4B
0xxxxx --> member 1
0xxxxx --> member 2
0xxxxx --> member 3
0xxxxx --> original address of virtual table
将虚函数表存储在结构后面,避免使用全局,静态的存储区