Hi,
I have a class where I am deliberately naming some of the member functions with the same name as common math library functions such as
log
, but using different types such as
string log(string);
Keeping the names identical between the math library and the class I'm writing is essential for a macro I'm using.
My problem is that inside my member functions I want to call on the math library functions, but the compiler seems to only look in the namespace of the class. I say namespace loosely because I mean in the class space even though I didn't create a namespace otherwise.
For example, if my class were called
myclass
, then here is an example to illustrate my problem:
1 2 3 4 5 6 7 8 9 10 11
|
string myclass::log(string in)
{
string out;
double inD=myFunc(in);
double outD=log(inD); // At this point the compiler has an issue:
// It can't seem to find the math library.
// It says:
//"error: no suitable conversion function
//from "std::string" to "double" exists
out=myFunc2(outD);
}
|
I can get around this by adding:
|
extern double log(double);
|
but I don't think I should have to.
Is there a way to say "not using namespace myclass?"
Thanks,
Sean