Hi... I'm having stupid problem with pointer to member functions. The following simple test program compiles, but crashes at run-time. Can anybody help me out here? class cTest{ public: double rand_mt(void){ return (1000.0); } double rand_cpp(void){ return (2000.0); } double (*cTest::nrand)(void); void init(int choice){ if (choice==1){ double (cTest::*nrand)() = &cTest::rand_cpp; } else { double (cTest::*nrand)() = &cTest::rand_mt; } } }; void main(){ cTest a; a.init(1); cout << a.nrand() << endl; } This simple program compiles, but crashes. It works fine if I don't use a class. Why? Thanks for your help, Niko
M
myhanguk
@myhanguk