1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
class Base
{
public:
virtual int F(){return 0;}
};
class A :public Base
{
public:
virtual int F(){return 1;}
};
class B :public Base
{
public:
virtual int F(){return 2;}
};
int main(int argc, _TCHAR* argv[])
{
A L_a;
B L_b;
Base L_base;
Base *L_pBase;
int (Base::*L_pf)();
L_pf = &Base::F;
int L_i;
L_pBase = &L_base;
L_i = (L_pBase->* L_pf)();
L_i = (L_base.*L_pf)();
L_pBase = &L_a;
L_i = (L_pBase->* L_pf)();
L_i = (L_a.*L_pf)();
L_pBase = &L_b;
L_i = (L_pBase->* L_pf)();
L_i = (L_b.*L_pf)();
return 0;
} |
Partager