Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Laroche

Functon pointers

This topic is 5604 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 use function pointers in my CScript class, however they seem to not be working. I belive the problem lies in my typedef:
typedef int (*pFunc)(CGame*);
 
This is supposed to be a typedef for a func-pointer take a CGame pointer as an argument and returning an integer. Later on in my code I call it like this:
  
void CCommand::Execute(CGame *pGame)
{
	int Result;
	Result = pFunc(pGame);
}
  
pFunc is a private member of CCommand. But I get an error message telling me that
C:\...\CCommand.cpp(46) : error C2440: ''='' : cannot convert from ''int (__cdecl *)(class CGame *)'' to ''int'' 
Why wouldnt this work? is it my typedef, or could it be something else?

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!