Using directive
#include <iostream>
namespace Math {
int add(int a, int b) { return a + b; }
int subtract(int a, int b) { return a - b; }
}
int main() {
using namespace Math;
// Now we can use Math functions without the Math:: prefix
std::cout << add(5, 3) << std::endl; // Outputs: 8
std::cout << subtract(10, 4) << std::endl; // Outputs: 6
return 0;
}Last updated