In Derivedthere template foo(T). There Baseare 2 overloads foo().
struct Base
{
void foo (int x) {}
void foo (double x) {}
};
struct Derived : Base
{
template<typename T> void foo (T x) {}
using Base::foo;
};
Now when foo()called with an object Derived; I want to use only Base::foo(int)if applicable, otherwise it should call Derived::foo(T).
Derived obj;
obj.foo(4); // calls B::foo(int)
obj.foo(4.5); // calls B::foo(double) <-- can we call Derived::foo(T) ?
In short, I need an effect:
using Base::foo(int);
Is it possible? The above is an example.
source
share