🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Overloaded functions

Started by
0 comments, last by Malmer 20 years ago
How do I deal with functions that have two of the same? Like this:
CMyClass::DoStuff( float x ); 
and
CMyClass::DoStuff( int x, int y, int z ); 
When doing a RegisterObjectMethod using the nice little asMETHOD macro like this: asMETHOD( CMyClass::DoStuff ) I get this error when compiling:

error C2440: ''type cast'' : cannot convert from ''overloaded-function'' to ''void (__thiscall asCDummy::* )(void)''
        None of the functions with this name in scope match the target type
 
Sollutions?
Advertisement
You need to cast the function to right type so that the compiler knows which one to choose.

(void CMyClass::*(float))CMyClass::DoStuff
(void CMyClass::*(int, int, int))CMyClass::DoStuff



__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game

[edited by - WitchLord on June 12, 2004 12:31:54 PM]

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement