Reputation: 22193
I've got the following classes:
class A: public Util<double> {}
class B: public Util<double>, public Interface {}
template<class T>
class MyTmp {
public:
void foo(const A& a);
}
class MyClass: public MyTmp<Other> {
public:
void foo(const B& b);
}
When I call foo
using an instance of MyClass
with a A
object for unknown reason the foo
method of MyClass
is called instead of foo
of class MyTmp
. I'm using gcc 4.4.2 using -O3. Any tips?
Upvotes: 3
Views: 61
Reputation: 65770
Member functions in derived classes with the same names as those in base classes hide the functions in the base class.
If you want MyTmp<T>::foo
to be available from MyClass
, you could as a using-directive:
class MyClass: public MyTmp<Other> {
public:
using MyTmp::foo;
void foo(const B& b);
}
Upvotes: 7