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;
}