Jump to content
  • Advertisement
Sign in to follow this  
BornToCode

Function overloading issue.

This topic is 3775 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

In my C++ class i have methods which are overloaded. In angel script i tried to bind those method but it keeps on telling me that it cannot differentiate which one of the overloaded method to use, event though i am passing the proper parameters to it. Here is an example of what i am doing This is my C++ class. int GetTileAnimationFrame(int index); int GetTileAnimationFrame(int x,int y); AngelScript. r = engine->RegisterObjectMethod("TileImage","int GetTileFrame(int x,int y)",asMETHOD(Emotion2D::CTileImage,GetTileAnimationFrame),asCALL_THISCALL);assert(r>=0); This is the error i am getting. cannot convert from 'overloaded-function' to 'void (__thiscall Emotion2D::CTileImage::* )(void)'

Share this post


Link to post
Share on other sites
Advertisement
For overloaded functions you need to use the asMETHODPR macro, which let's you inform the parameters and return type of the method. Otherwise C++ won't know which function you want to take the address of.

Share this post


Link to post
Share on other sites
or you should be able to cast the method pointer (this what you do with boost.python):

(int (Emotion2D::CTileImage::*)(int,int))&GetTileAnimationFrame

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!