I'm a bit unsure on how you're "supposed" to work with namespaces in C++.
Say, you have a headerfile declaring a class inside a namespace, something like this:
namespace foo {
class bar {
void somefunction();
void someotherfunction();
}
}
So far so good. But is there a "proper" way to write the corresponding cpp file?
So far, I've wrapped those into namespace foo { } as well:
namespace foo {
void bar::somefunction(){
}
void bar::someotherfunction(){
}
}
But Visual Studio 2k5's Intellisense can't figure that out. It doesn't recognise class members. (Still compiles ok though) So that made me wonder, am I doing it "wrong"?
I can think of two alternatives.
Either specify the full namespace on every function in the cpp file, like this:
void foo::bar::somefunction(){
}
But that seems a bit verbose. Doesn't exactly help with code readability.
Or alternatively, just put a "using namespace foo" at the top of the cpp file.
But that doesn't seem a very elegant solution? I thought blanket "using namespace ..." statements were discouraged?
Anyone know what the "proper" way to do this is?