Skip to main content
GameDev.net gamedev.net
🔒 Locked

Overloaded functions

Started by Malmer Jun 12, 2004 at 9:44 AM 0 replies 1.3k views
Original Post
Malmer
Malmer
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?
WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.