Skip to main content

C++ Template

#ifndef FOO_BAR_BAZ_H_
#define FOO_BAR_BAZ_H_

namespace mynamespace {

// All declarations are within the namespace scope.
// Notice the lack of indentation.
class MyClass {
public:
...
void Foo();
};

} // namespace mynamespace

#endif // FOO_BAR_BAZ_H_
// In the .cc file
namespace mynamespace {

// Definition of functions is within scope of the namespace.
void MyClass::Foo() {
...
}

} // namespace mynamespace

Source