Why do I have to reintroduce the name of a function having some of its overloads deleted ?
#include <string>
struct A
{
void f(int) {}
void f(double) {}
void f(const std::string&) {}
};
struct B : public A
{
using A::f; // needed to compile : why ?
void f(int)=delete;
void f(double)=delete;
};
int main()
{
B b;
b.f(std::string("toto"));
}
A single declaration of f
in the B
class hides all declarations of f
from the base A
class.
And even marking the functions as deleted is considered a declaration.