A
anoopsaha
Hi all,
I have a class X with a member function dump(). Now there is another
version of dump() which is globally defined in some third party include
file. From another member function of X, I wish to call the global
dump() function. How can I achieve that? Because of legacy reasons, I
cannot change the name of either of the functions, or their number of
arguments.
Here is a piece of code to illustrate the problem.
#include <iostream>
using namespace std;
int dump(int input, int in2)
{
cout << " Global dump" << endl;
}
class A
{
public:
A() {};
~A() {};
int dump(int input)
{
cout << "In class A" << endl;
}
int func(bool in)
{
if (in)
dump (0);
else
dump (1, 1);
}
};
when you compile it, it gives the following error ;
anoop@anoop[27] g++ -c a.cxx
a.cxx: In member function `int A::func(bool)':
a.cxx:24: no matching function for call to `A::dump(int, int)'
a.cxx:16: candidates are: int A::dump(int)
Thanks in advance,
Anoop
I have a class X with a member function dump(). Now there is another
version of dump() which is globally defined in some third party include
file. From another member function of X, I wish to call the global
dump() function. How can I achieve that? Because of legacy reasons, I
cannot change the name of either of the functions, or their number of
arguments.
Here is a piece of code to illustrate the problem.
#include <iostream>
using namespace std;
int dump(int input, int in2)
{
cout << " Global dump" << endl;
}
class A
{
public:
A() {};
~A() {};
int dump(int input)
{
cout << "In class A" << endl;
}
int func(bool in)
{
if (in)
dump (0);
else
dump (1, 1);
}
};
when you compile it, it gives the following error ;
anoop@anoop[27] g++ -c a.cxx
a.cxx: In member function `int A::func(bool)':
a.cxx:24: no matching function for call to `A::dump(int, int)'
a.cxx:16: candidates are: int A::dump(int)
Thanks in advance,
Anoop