Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- creating methods that doesn't depend on a object
- //functions.h
- namespace MyFunctions
- {
- void foo();
- void goo();
- }
- //functions.cpp
- namespace MyFunctions
- {
- void foo() {}
- void goo() {}
- }
- //functions.h
- inline void foo() {
- //..
- }
- inline void goo() {
- //..
- }
- //fileThatUsesFunctions.cpp
- namespace
- {
- void foo() {}
- void goo() {}
- }
- namespace Utils
- {
- void myMethod();
- }
- namespace Utils
- {
- void myMethod()
- {
- //Implementation
- }
- }
- namespace Foo
- {
- publicFunction1();
- publicFunction2();
- namespace
- {
- privateFunction1();
- std::vector<Bar> privateData;
- }
- }
- // MyFile.h
- int some_function();
- // MyFile.cpp
- int some_function() {
- return 42;
- }
- // MyFile.h
- namespace MyNamespace {
- int some_function();
- }
- // MyFile.cpp
- using MyNamespace;
- int some_function() {
- return 42;
- }
Advertisement
Add Comment
Please, Sign In to add comment