Some Tips About C++
2017-01-11 09:10
411 查看
Some Tips About C++
1 . 引用和取地址int &val2 = val1; // 引用是变量的别名,在左侧 int *p = &val; // 取地址是在右侧,p存储val地址
2 . 构造函数
2.1 构造函数的多种初始化的方法
2.2 复制构造函数 参数必须是本类的引用,不能是参数
A(){} A(A &a){} // 这里复制构造函数的参数是本类的引用,不能为A a
3 . static 静态成员
3.1 静态成员变量,静态成员函数。
3.2 静态成员和普通成员区别
变量 | Are |
---|---|
静态成员变量 | 为所有变量说共享 |
普通成员变量 | 每个成员有各自的一份 |
4. cin和getline()区别
cin 和getline区别 cin遇到空格停止,getline遇到回车停止
// testcase:hello world string inputWords_cin; string inputWords_getline; cout << "Please input inputWords_getline:"; getline(cin, inputWords_getline); cout << inputWords_getline << endl; cout << "Please input inputWords_cin:"; cin >> inputWords_cin; cout << inputWords_cin << endl;
输出结构:
5 . 字符串处理函数声明的头文件.
如:isalnum( c ) isalpha( c )等
相关文章推荐
- some tips about vector in C++ STL
- some tips about sys.objects table
- some tips about python default value....
- Some tips about argument in python
- Some tips about Selenium UI testing
- Some Tips About Layout Resource
- Some Tips about Interbase
- Some useful tips about sox rec
- Some Tips and Tricks about Qt
- Some Tips and Tricks about Qt
- Some interesting facts about static member functions in C++
- some tips about web hacking
- Share some tips about android develop(一)
- Some tips about how to reverse Array with C#
- Some tips about python
- some tips about shell variables
- Some tips about ubuntu server | or it may works on other linux distributions too
- Some tips about crawling large external data with bcs connector
- Some tips about Class in Python
- MaxPooling的作用 and some tips about CNN