把《Effective C++》读薄
来源:互联网 发布:java int转short 编辑:程序博客网 时间:2024/04/28 03:35
这本书很早就打算看了,但是一直没有开始。我觉得这本书其实只需要有一定C++经验,越早接触越好!
1
- view c++ as a federation of languages
应该看作C、STL、Templete、面对对象四个部分 - prefer consts,enum,inline to #define
- use const whenever possible
- make sure the objects are initialized before they are used;
//这些都是初始化int x=0;const char* a="abcde";double d;cin>>d;Shit(string name,string address):name(name),address(address){}//Shit(stirng name,string address){this.name=name,this.address=address;}会先赋初值
2 Constructor,Destruction,and Assignment Operators
- know what function C++ silently write and calls
- Explicitly disallow the use of complier-generated functions you do not want
- Declare destructors virtual in polymophic base classe
- Prevent exception from leaving destructors
- Never call virtual function during construction or destruction
- Have assignment operator return a reference to *this
- Handle assignment to self in operator =
3 Resource Management
- use object to manage resources
- think carefully about copying behavior in resources manage classed
- provide access to raw resources on resource-managing classedd
- use the same form in corresponding use of new and delete
- store new objects in smart pointers in standalone statements
4 Design and Declarations
- make interfaces easy to use correctly and hard to use incorrectly
- treat class design as type design
- prefer pass-by-reference-to-const to pass-by-value
- don’t try to return a reference when you must return an object
- declare date member private
- prefer non-member non-friend functions to member functions
- declare non-member functions when type conversions should apply to all parameters
- consider support for a non-throwing swap
0 0
- 把《Effective C++》读薄
- 把《C++Primer》读薄
- 《Effective C++》和《More Effective C++》汇总
- 《Effective C++》读书笔记
- 《Effective C#》 翻译札记
- 《Effective C++》读感
- 《Effective C++》读后感
- 读《Effective C++》所想
- 《Effective C++》读书笔记
- 《Effective C#》 翻译札记
- 细读《Effective C++》之一
- 《Effective C#》 翻译札记
- effective c sharp 印象
- 细读《Effective C++》之一
- Begin reading 'Effective c++'
- 《Effective C#》 翻译札记
- 《Effective c++》读书笔记
- 《Effective C++》 笔记
- jspEL的表达式<c:if ne>
- Xcode 7免证书真机调试
- 机房收费文档第一遍总结
- hdu 1503 Advanced Fruits(最长公共子序列的应用)
- css知多少(11)——position
- 把《Effective C++》读薄
- iOS9适配系列教程
- TestLink知识点Mantis知识点
- 获取tinyMCE编辑器中的内容
- c++设计模式-----Facade外观模式
- 学习dojo一个很好的网址:有很多小例子
- JAVA中变量和常量的理解
- HDU 5461.Largest Point【2015 ACM/ICPC Asia Regional Shenyang Online】【排序】9月19
- Mac OS启动服务优化高级篇