In Derived
there is a template foo(T)
. There are 2 overloads of foo()
in Base
.
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()
is called with Derived
object; I want to use only Base::foo(int)
if applicable, otherwise it should invoke 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 want an effect of:
using Base::foo(int);
Is it possible ? Above is just an example.