#include <iostream>
using namespace std;
namespace A { int threshold = 50; }
namespace B { int threshold = 75; }
int main() {
cout << "A.threshold=" << A::threshold << "\n";
cout << "B.threshold=" << B::threshold << "\n";
return 0;
}
Solution Explanation
Two separate namespaces each define a variable with the same name.
A::threshold and B::threshold disambiguate which one you want.
Layman’s Terms
Think of two folders both having a file called threshold.txt. You must specify the folder name to open the right file.
Significance for Embedded Developers
Large firmware bases often have multiple modules (UART, ADC, PWM) that might use common parameter names. Namespaces keep these parameters organized and conflict-free.