Calling a function overloaded in several namespaces from inside one namespace

前端 未结 3 562
广开言路
广开言路 2021-01-02 16:51

I have the following code snippet:

void foo(double a) {}

namespace bar_space
{
  struct Bar {};

  void foo(Bar a) {}
}

foo(double) is a g

3条回答
  •  醉话见心
    2021-01-02 17:49

    Yes, bar_space is hiding the original function and no, you can't make foo(5.0) callable from whithin bar_space without explicit scoping if foo(double) is defined in the global namespace.

提交回复
热议问题