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?
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With