In a C++ class, we can write our members in either of two styles. We can put them inside of a namespace block, or we can fully qualify each.
Is there any reason to prefer one style over the other?
Header file looks like this (bar.h):
namespace foo
{
class Bar
{
public:
Bar();
int Beans();
};
}
Style 1 (bar.cpp) - Declarations within namespace block:
#include "bar.h"
namespace foo
{
Bar::Bar()
{
}
int Bar::Beans()
{
}
}
Style 2 (bar.cpp) - Fully qualified declarations:
#include "bar.h"
foo::Bar::Bar()
{
}
int foo::Bar::Beans()
{
}
So my question, again, is: is there any reason to prefer one style over the other?