Original Post
Hi,
i'm using a formatting print routine which gets ellipses as parameter. This means the routine does not know at runtime what types it will get passed.
Now i have a class that holds a parameter (internally as string), but i overloaded conversion operators for int, float and std::string for convinience.
Now if i call the print routine with that class as parameter,
which conversion operator will be chosen?
CMisc::printf( "%06d", m_GameData.m_Score );It seems i got lucky and it worked; so my guess in this case the compiler choses int as the "general" operator (just as it assumes unknown functions being int functionname( int ); ). Am i guessing correct? Did i just get very very lucky? [edit: Correction] It doesn't work, i looked wrong. But anyway, what happens? It doesn't crash either and the debugger didn't let me check inside the operator, so i don't know which conversion is actually used. [2nd edit: Dang] Dang. Of course none of the operators is called. The object is passed by value. Simple as that. Thanks all for reading, that's all folks! [edited by - Endurion on January 8, 2004 5:27:24 AM]