Consider I have the following function prototype:
void MyFunction(int MyParameter);
With the following definition:
void MyFunction(int MyParameter)
{
// Do stuff here.
}
Where should they each be put if I have a header file (no main
function) with a namespace? Does the prototype go in the namespace and the definition outside it? Or do they both go in?
If you choose to have a namespace, both should be inside :
.h :
namespace MyNameSpace {
void MyFunction(int MyParameter);
}
.cpp :
void MyNameSpace::MyFunction(int MyParameter)
{
// Do stuff here.
}