|
// ASM2CPPInvoker.cpp : Definiert den Einsprungpunkt f�r die Konsolenanwendung.
//
#include "stdafx.h"
class ServiceA
{
char c;
public:
void sub(int a, int b)
{
printf("ServiceA: %d - %d = %d\n", a, b, a-b);
}
virtual void add(int a, int b)
{
printf("ServiceA: %d + %d = %d\n", a, b, a+b);
}
virtual void mul(int a, int b)
{
printf("ServiceA: %d * %d = %d\n", a, b, a*b);
}
};
class ServiceB : public ServiceA
{
public:
void sub(int a, int b)
{
printf("ServiceB: %d - %d = %d\n", a, b, a-b);
}
virtual void add(int a, int b)
{
printf("ServiceB: %d + %d = %d\n", a, b, a+b);
}
};
typedef void (ServiceA::*TypeAPtr)(int, int);
int main(int argc, char* argv[])
{
ServiceA serviceA; ServiceB serviceB;
ServiceA *pSA = &serviceB;
TypeAPtr _add = &ServiceA::add;
pSA->add(10,50);
pSA->mul(102,50);
pSA->sub(20,5);
(pSA->*_add)(10,20);
_asm
{
lea ecx, serviceB;
push 60;
push 40;
call _add;
}
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.