46. Nested Namespace Declaration

Back To All Submissions
Previous Submission
Next Submission
#include <iostream>
using namespace std;

namespace Config {
    namespace ADC { int resolution = 12; }
    namespace PWM { int frequency = 1000; }
}

int main() {
    cout << "ADC.resolution=" << Config::ADC::resolution << '\n';
    cout << "PWM.frequency="  << Config::PWM::frequency ;
    return 0;
}

: :  scope resolution 

 

 

 

 

Was this helpful?
Upvote
Downvote