#include<iostream>
#include<cstring>
using namespace std;
namespace A { //namespace+ xxx 命名的书写格式,自定义的域
int a;
float b;
void show()
{
cout << "你好世界" << endl;
}
//可以嵌套
}
using A::b; //如果程序中只想到一个名字空间中的一个变量符
using A::show;
int main()
{
cout << A::b << endl;//就是域解析符 作用:解析某个域中的某个字符
cout << "hello world" << endl;
show();
return 0;
}
#include<iostream>
using namespace std;
class stu
{
public:
int age = 10;
string name = "NN";
int height = 175;
void action()
{
cout << "hello world" << endl;
}
};
int main()
{
stu tu;
cout << tu.age << endl;
cout << tu.name << endl;
cout << tu.height << endl;
tu.action();
return 0;
}