example2_namespace_members.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <iostream>

namespace Math {
    const double PI = 3.14159;
    double square(double x) { return x * x; }
}

int main() {
    using Math::PI;
    using Math::square;

    std::cout << "Pi: " << PI << std::endl;
    std::cout << "5 squared: " << square(5) << std::endl;

    return 0;
}
Back to using