// https://www.geeksforgeeks.org/namespace-in-c/
#include <iostream>
using namespace std;
// first name space
namespace first_space {
void func() {
cout << "Inside first_space" << endl;
}
}
// second name space
namespace second_space {
void func() {
cout << "Inside second_space" << endl;
}
}
using namespace first_space;
//using namespace second_space;
int main () {
// This calls function from first name space.
func();
return 0;
}
http://www.cplusplus.com/doc/tutorial/namespaces/
#include <iostream>
using namespace std;
// first name space
namespace first_space {
void func() {
cout << "Inside first_space" << endl;
}
}
// second name space
namespace second_space {
void func() {
cout << "Inside second_space" << endl;
}
}
using namespace first_space;
//using namespace second_space;
int main () {
// This calls function from first name space.
func();
return 0;
}
http://www.cplusplus.com/doc/tutorial/namespaces/
using
The keywordusing
introduces a name into the current declarative region (such as a block), thus avoiding the need to qualify the name. For example:
|
|
No comments:
Post a Comment