, " , ".
, , , , .
, , , . , , , , , , , , .
, , .
, - mulitple, header/implementaion, .
Whether you put this function in a namespace, in a global scope, or as a static function in a class, it really is to your taste.
In a final note, if you go for a global static function, there is a version of "C ++ like": anonymous namespaces. It has the good property that it can actually maintain state, and also does not allow users to force even to declare any of their functions.
namespace
{
void foo()
{
}
};
void MyClass::FooUser1() { foo(); }
void MyClass::FooUser2() { foo(); }
Smocode
source
share