First of all, let’s say two differences:
1) There are directives like using namespace std;using declarations likeusing std::cout;
2) You can put using directives and declarations in the header (.h) or the implementation file (.cpp)
In addition, the use of directives and declarations brings names into the namespace in which they are written, i.e.
namespace blah
{
using namespace std;
}
Now, from a best practice point of view, it is clear that using directives and declarations in the header file in the global namespace is a terrible no-no. People will hate you for this because any file that includes this header will be polluted by the global namespace.
, . , . , , ( ).
, , , "" , .
namespace MyLocalName
{
using namespace boost;
class X
{
};
}
using MyLocalName::X;
using namespace boost; -, Boost .