- 18


; demo_3 BASE

push offset aNonVirtualBase ; "Non virtual BASE DEMO 3\n"

call printf

pop ecx

retn

BASE_DEMO_3 endp

DERIVED_DEMO proc near ; CODE XREF: main+31p

; demo DERIVED

push offset aDerived ; "DERIVED\n"

call printf

pop ecx

retn

DERIVED_DEMO endp

DERIVED_DEMO_2 proc near ; CODE XREF: main+39p

; demo DERIVED

push offset aDerivedDemo2 ; "DERIVED DEMO 2\n"

call printf

pop ecx

retn

DERIVED_DEMO_2 endp

BASE_DEMO_3_ proc near ; CODE XREF: main+41p

; demo_3 BASE

; ! demo_3 !

; BASE,

; DERIVED,

; , ? ...

; ...

push offset aNonVirtualDeri ; "Non virtual DERIVED DEMO 3\n"

call printf

pop ecx

retn

BASE_DEMO_3_ endp

GetBASE_VTBL proc near ; CODE XREF: main+9p

; BASE

mov eax, ecx

mov dword ptr [eax], offset BASE_VTBL

retn

GetBASE_VTBL endp

GetDERIVED_VTBL proc near ; CODE XREF: main+29p

; DERIVED

push esi

mov esi, ecx

call GetBASE_VTBL

; ! , BASE!

mov dword ptr [esi], offset DERIVED_VTBL

; DERIVED

mov eax, esi

pop esi

retn

GetDERIVED_VTBL endp

BASE_VTBL dd offset BASE_DEMO ; DATA XREF: GetBASE_VTBL+2o

dd offset BASE_DEMO_2

DERIVED_VTBL dd offset DERIVED_DEMO ; DATA XREF: GetDERIVED_VTBL+8o