Is there any difference between wrapping both header and cpp file contents in a namespace or wrapping just the header contents and then doing using namespace
I think right thing to do here is to use namespace for scoping.
namespace catagory
{
enum status
{
none,
active,
paused
}
};
void func()
{
catagory::status status;
status = category::active;
}
There's no performance penalties, since the resulting could would be the same, but putting your Foo
into namespace implicitly introduces ambiguity in case you have Foo
s in different namespaces. You can get your code fubar, indeed. I'd recommend avoiding using using
for this purpose.
And you have a stray {
after using namespace
;-)