what is namespace in c++
Namespaces avoids name collisions bacause of large libraray in c++.
This feature was not supported in C
what is namespace in c++
Namespaces avoids name collisions bacause of large libraray in c++.
This feature was not supported in C
what is namespace in c++
//namespace is a declarative region to provide scope for identifiers
#include <bits/stdc++.h>
using namespace std; //including namespace std for cin and cout
//my custom namespace for variables and functions
namespace abc
{
void fun()
{
cout<<"Hello world"<<endl;
}
int x=10;
}
using namespace abc;
int main()
{
cout<<10;
fun();
return 0;
}
c++ namespace example
#include <iostream>
using namespace std;
namespace square{
int x;
int y;
}
int main(){
using namespace square;
x = 10;
y = 0;
cout << x << y << endl;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us