Tag Archives: Namespaces in C++

Namespaces in C++

In a C++ program if we redefine a variable or function with the same name in the same scope then the compiler would throw an error “has a previous declaration”. Example #include <iostream> using namespace std; int main() {    int x= 10;    double x= 20;    cout<<x; } Output (ERROR) Compiler Error: ‘x’… Read More »