Why does using ::foo declaration below hide all other foo functions?
#include <iostream>
void foo(double) { std::cout << "::foo(double)" << std::endl; }
struct A {
void foo(float) { std::cout << "A::foo(float)" << std::endl; }
void foo(int) { std::cout << "A::foo(int)" << std::endl; }
void foo() { std::cout << "A::foo()" << std::endl; }
};
struct B : A {
using A::foo;
void foo(int) { std::cout << "B::foo(int)" << std::endl; }
void foo() { std::cout << "B::foo()" << std::endl; }
void boo() {
using ::foo;
foo(1.0);
foo(1.0f);
foo(1);
foo();
};
};
int main() {
B b;
b.boo();
return 0;
}
std::swapin copy-swap idiom. stackoverflow.com/questions/4782692/…B::foo()?usingdeclaration is lost since i could also call::foo(1.0),A::foo(1.0f), etc..