Jump to content
  • Advertisement
Sign in to follow this  
DigiMan Shart

Function Pointer within Member Function

This topic is 3586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've created a class cFileIO that Loads Files with a member function that looks like this: int ReadAndParseFile(std::string &fileName, int (*Load)(std::string &filePath)); The problem is when I call the member function somewhere else within another class's member function I get a compiler error from Visual studios that says: error C3867: cModelManager::LoadModel: function call missing argument list; use '&cModelManager::LoadModel' to create a pointer to member This is where I'm having the error: void cModelManager::LoadAllModels(void) { cModel temp("default"); cFileIO FileLoader; FileLoader.ReadAndParseFile(temp.fileName,LoadModel); } Any help would be appreciated. Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Member function pointers are a totally different thing than regular function pointers. Read this and this.

Two solutions might be to accept a templated function (which could be instantiated as a stateful functor) or boost::function<>.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!