C++ namespace Define function inside namespace
#include <cstdio> #include <cstdlib> #include <iostream> #include <cmath> using namespace std; namespace Mathematics { double log(double x) {/*w ww. ja v a 2 s.co m*/ return log10(x); } } namespace SystemLog { int log(double x) { cout << "Logged " << x << endl; return 0; } } int main(int nNumberofArgs, char* pszArgs[]) { double dl = Mathematics::log(10); SystemLog::log(dl); return 0; }