⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aaa.c

📁 用C实现虚函数表的例子
💻 C
字号:
// StringManager.cpp: implementation of the CStringManager class.
//
//////////////////////////////////////////////////////////////////////

#include "aaa.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IAAA* AAA_New()
{
	IAAA * pMe = NULL;

	VTBL(IBBB) *modFuncs;

	// Allocate memory for the ExtensionCls object
	if( (pMe =(IAAA *)MALLOC(sizeof(AAA) + sizeof(IBBBVtbl))) == NULL )
		return NULL;

	//pMe->pAaa = TEST_New(); 
	// Allocate the vtbl and initialize it. Note that the modules and apps must not
	// have any static data. Hence, we need to allocate the vtbl as well.
	modFuncs = (IBBBVtbl *)((byte *)pMe + sizeof(BBB));
	//Initialize individual entries in the VTBL

	modFuncs->Refresh	= BBB_Refresh;
	modFuncs->aa		= BBB_aa;
	modFuncs->bb		= BBB_bb;
	modFuncs->cc		= BBB_cc;
	modFuncs->ww		= BBB_ww;
	modFuncs->DD		= AAA_DD;

	// initialize the vtable
	INIT_VTBL(pMe, IBBB, *modFuncs); 

	// initialize the data members

	DBGPRINTF("TEST_AAAAAAAAAAAAAAAAAAA");

	return (IAAA *)pMe;
}


void AAA_DD(IAAA *po)
{
	AAA *pMe = (AAA *)po;
	DBGPRINTF("DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
	pMe->tt = 88;
	DBGPRINTF("%d**************************************",pMe->tt);
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -