摘要:
Declare data members private1、使数据成员private,保持了语法的一致性,client不会为访问一个数据成员是否需要使用括号进行函数调度,还是不使用括号直接访问成员而纠结。2、使数据成员private,if you use functions to get or s... 阅读全文
摘要:
Prefer pass-by-reference-to-const to pass-by-value1、By default, C++ passes objects to and from functions by value (a characteristic it inherits from ... 阅读全文
摘要:
Make interfaces easy to use correctly and hard to use incorrectly1、That being the case, if they use one incorrectly, your interface is at least parti... 阅读全文
摘要:
Provide access to raw resources in resource-managing classes1、You need a way to convert an object of the RAII class (in this case, tr1::shared_ptr) i... 阅读全文
摘要:
1、除了内存资源以外,Other common resources include file descriptors, mutex locks, fonts and brushes in graphical user interfaces (GUIs), database connections, ... 阅读全文
摘要:
Never call virtual functions during construction or destruction1、you shouldn't call virtual functions during construction or destruction, because the... 阅读全文