C++ examples for Statement:namespace
Define function inside namespace, call function with namespace
#include <cstdio> #include <cstdlib> #include <iostream> #include <cmath> using namespace std; namespace Mathematics { double log(double x) {/*from w ww . j a v a 2s .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; }