1、复制构造函数
形式
man(const man &person) {}
/* 复制构造函数一定要带const */
2、读取文件ifstream,写入文件ofstream
ifstrem infile;
infile.open("xxx.txt");
infile >> data; // 把文件内容读到data里;
infile.close();
ofstream outfile;
outfile.open("xxx.txt");
outfile << ;
3、类模板
无法将函数定义与现有的声明匹配
1、函数返回类型,函数名,参数写错
2、如果类是模板类,函数是函数模板,那么这个两个的typename不能放在一起,要单独写
template <typename T>
template <typename VST>
4、虚函数
只需要在声明时加virtual,在定义时不需要加
5、让cin/cout更快
ios::sync_with_stdio(false);
cout.tie(NULL);
6、map
map<string, int> mp;
if (mp.find(x) != mp.end()) // x是下标,string
mp.insert(pair<stirng, int> (x, 1));
7、malloc和string
malloc不会调用构造函数
string是可变长,不初始化应该没法赋内存