Hello NG,
I have a ordinary class `Base' with two functions `void foo()' and
`void any()':
class Base {
public:
Base() {}
void foo() {}
void any() {}
};
and I have a template `Templ<T>', which is derived from `Base', and defines
a function `void foo(T)', e.g. of the same name as the `Base' function, but
with different parameter types:
template <typename T>
class Templ : public Base
{
public:
Templ() {}
void foo(T t) {}
};
I had expected, that both `foo()'-functions should be distingushable. But
in fact the compiler does not resolve to Base::foo(), if I write `foo()' for
a `Templ' instance:
int main()
{
Templ<int> a;
a.any(); // OK --> Base::any()
a.foo(4); // OK --> Templ::foo(int)
a.foo(); // compiler *error*:
// no matching function for call to `Templ<int>::foo()'
((Base&)a).foo(); // OK --> Base::foo()
}
What is the reason for that?
I could imagine, that the compiler want to see a template parameter
dependency for all functions of a template instance, but if so, why
then `any()' is found?
Greetings
Hartmut