vtable layout and lookup

struct cA ;

struct A_vtbl
{
void (__stdcall* pfn_mem_fun)( struct cA* this, int v ) ;
void (__stdcall* pfn_mem_fun2)( const struct cA* this ) ;
void (__stdcall* pfn_mem_fun3)( struct cA* this ) ;
void (__stdcall* pfn_destructor)( struct cA* this ) ;
};

struct cA
{
struct A_vtbl* vptr ;
char c1 ;
int i ;
char c2[1] ;
};

void cfun( struct cA* pa )
{
//pa->mem_fun2() ;
pa->vptr->pfn_mem_fun2(pa) ;
//pa->mem_fun(100) ;
pa->vptr->pfn_mem_fun(pa,100);
}

Popular posts from this blog

Long running Java process resource consumption monitoring , leak detection and GC tuning

Best practises - Selenium WebDriver/ Java

Java Script Development Guidlines