都说using namespace std不能乱用,这是为啥.每个文件都用了这个,他定义的变量就都不会和标准库的冲突了啊..
比如我在hehe.h中
int cin=1; (没有用std,假如不知道cin是std有的,我定义了这么一个变量)
然后在hh.cpp中include这个.
#include"hehe.h"
#include<iostream>
using namespace std;
int main()
{
cout << "Hello world!" ;
cout<<cin;
return 0;
}
提示cin二义性..
如果我在头文件就用了using namespace,我不是提前就知道了不能定义cin了么
比如我在hehe.h中
int cin=1; (没有用std,假如不知道cin是std有的,我定义了这么一个变量)
然后在hh.cpp中include这个.
#include"hehe.h"
#include<iostream>
using namespace std;
int main()
{
cout << "Hello world!" ;
cout<<cin;
return 0;
}
提示cin二义性..
如果我在头文件就用了using namespace,我不是提前就知道了不能定义cin了么