In the example below, is it necessary to use namespace A{} in the source file or is it redundant as it is already been done in the header file?
// header file Foo.h
namespace A
{
class Foo
{
Foo();
};
}
// source file Foo.cpp
#include "Foo.h"
namespace A
{
Foo::Foo() {}
}
namespace A;is an easier way of doing this as it doesn't indent the entire rest of the file.namespace A;is not proper syntax. What is it supposed to mean?using namespace A;would work as long as there are no name collisions with the global namespace.