45. Same-Named Variables

Back To All Submissions
Previous Submission
Next Submission
#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;
}

Solving Approach

 

 

 

 

 

Was this helpful?
Upvote
Downvote