
Untitled
By: a guest on
Jul 29th, 2012 | syntax:
None | size: 0.85 KB | hits: 9 | expires: Never
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;
}