   [C++]Passing a method pointer [SOLVED]
  Hi I was wondering if anyone could help me. I want to pass a class method pointer to another class as a parameter, but I'm not sure how, or even if its possible.This is how I create my method pointer:   CPlayerManager* pPlayMan = new CPlayerManager;typedef void (CPlayerManager::*pMEMFUNC)(void);pMEMFUNC pRenderFunc = &CPlayerManager::Render;I then want to pass that method to the shader handler to render I thought something like this but I dont know what to tell the shader handler render method to expect?:mpLightingClass->Render<CPlayerManager*>(pPlayMan, pRenderFunc);Thanks[Edited by - Downie on May 13, 2009 5:44:26 PM]
  If you use `CPlayerManager' as your template parameter, instead of `CPlayerManager *', it's quite easy:#include <iostream>struct CPlayerManager {  void Render(void) {    std::cout << "Render!" << std::endl;  }};struct LightingClass {  template <class PM>  void Render(PM *pm, void (PM::*method)(void)) {    (pm->*method)();  }};int main() {  CPlayerManager* pPlayMan = new CPlayerManager;  typedef void (CPlayerManager::*pMEMFUNC)(void);  pMEMFUNC pRenderFunc = &CPlayerManager::Render;    LightingClass* mpLightingClass = new LightingClass;  mpLightingClass->Render<CPlayerManager>(pPlayMan, pRenderFunc);    delete mpLightingClass;  delete pPlayMan;};  Thanks, I had tried that but I was missing the brackets round the function call:(pTemplate->*RenderFunc)();Cheers again   