"Manuel González Castro" <iinmgc00@ucv.udc.es> wrote...
Hello,
I'd like to have 2 overloaded methods "parse" in my class,
They are not overloaded. The one in the derived class _hides_
the one in the base.
one of them
comming from a base class template speciallization and the other one added
in the derived Class:
------- file "MyTemplate.h" -------
#include <iostream>
template<class my_type> class MyTemplate {
public:
virtual void parse(double input) { } // This is the 1st method
// other member functions ...
};
------- file "MyClass.h" -------
#include "MyTemplate.h"
#include <string>
class MyClass : public MyTemplate<std::string> {
public:
virtual void parse(char* input) { } // This is the 2nd method
Add here:
using MyTemplate<std::string>::parse;
};
------- file "main.cpp" -------
#include "MyClass.h"
int main()
{
double x = 0.0;
MyClass myclass;
myclass.parse(x); // line #6 gives a compile error !
return 0;
}
------- end of code -------
I get and error in line #6:
'parse': cannot convert parameter 1 from 'double' to 'char *
Why can't the compiler find the method void parse(double input) ?
Because it's hidden.
Victor
.