// ¸â¹ö ÇÔ¼ö Æ÷ÀÎÅÍ
// http://www.gpgstudy.com/forum/viewtopic.php?t=13618&highlight=%B0%A1%BB%F3%C7%D4%BC%F6
#include <stdio.h>
#include <tchar.h>
struct Base
{
virtual void Compute( int n ) { printf( "Base: %d\n", n ); }
};
struct Derived : public Base
{
virtual void Compute( int n ) { printf( "Derived: %d\n", n*n ); }
};
void _tmain(int argc, _TCHAR* argv[])
{
Derived obj;
Base* pBase = &obj;
void (Base::*func)( int );
func = static_cast<void (Base::*)(int) >( &Derived::Compute );
(obj.*func)( 2 );
(pBase->*func)( 2 );
}