I know that we should not add a code like this in a header file:
using namespace std;
but what about this:
namespace foo
{
class A
{
public:
void add()
{
using namespace std;
// do some work here
}
}
}
As far as I know then std is only brought out into function add and no to any other classes in the name space.
Is it still not acceptable? Why?
class A
is in namespacefoo
, it automatically looks up names infoo
.std::
is just 5 characters.