member methods overloading - have I gone stupid?
Hi ANYONE!
I'm using MS Visual Studio (I can only attribute this to the compiler), and have an overloaded method:
void FuncName(unsigned short id_num, Type_t &ret_val);
void FuncName(const char *id_name, Type_t &ret_val);
Where the "ret_val" may be found by it's numerical id (first func) or it's logical name (second).
When using the second method
FuncName("value_logical_name",ret_val);
I get a compiler error, that parameter one can not be converted from const char[] to unsigned short.
The only problem is that it is not constant!!! In some projects it will work, and in some it wont.
Does anybody have any idea why? Is it something with the project settings? WHAT?!
Thanks
why don't u use templates for this???
This question is directed to paul - but of course anyone can provide an answer to my question :
The question is :
Instead of function overloading, don't you think that the correct way is now through the use of templates?
and if not the next question would be :
when would you use templates instead of function overloading and vice versa?
Its just to satisfy my curiosity more than anything.
Best regards
John