namespaces/namespace-2.cc - Illustrating that a namespace interface is separated from the namespace implementation. | Lecture 3 - slide 23 : 27 Program 1 |
// We see a namespace interface followed // by definition/implementation of the functions // in the namespace. namespace N{ // The namespace interface int f(int i); double g(); } int N::f(int i){ // The namespace implementation return 2*i; } double N::g(){ return f(2); } int main(){ using N::f; int r = f(5); double d = N::g(); }