I'm having a problem with using C++ overloading and was wondering if anybody could help.
I'm trying to overload functions so that its argument accept reference and literal respectively.
For example, I want to overload func1
and func2
to func
:
int func1 (int literal);
int func2 (int &reference);
and I want to use func
in this situations:
func(3); // call func1
int val = 3;
func(val); // I want func2 to be called, but ambiguous error
Is there any way to overload these functions?
thanks! Any help would be appreciated! sorry for poor english.