Effective C++确实是一本好书,虽然现在看得还一知半解。
item1: View C++ as a federation of languages
视C++ 为一个语言联邦
item2: Perfer consts,enums,and inlines to defines
尽量以const,enum,inline替换 #define
item3: Use const whenever possible
尽可能使用const
item4:Make sure that objects are initialized before they are used
对象使用前要初始化
item5: Know what functions C++ silently writes and calls
了解C++默默编写并调用的哪些函数
item6: Explicity disallow the use of compiler-generated functions you do not want
若不想使用编译器自动生成的函数,就应该明确拒绝
item7: Declare destructors virtual in polymorphic base classes
为多态基类声明virtual 析构函数
item8: Prevent exceptions from leaving destructors
别让异常逃离析构函数
item9: Never call virtual functions during construction or destruction
绝不在构造和析构函数中调用virtual 函数
item10: Having assignment operators return a reference to *this
令operator = 返回一个reference to *this
item11: Handle assignment to self in operator
在operator =中处理自我赋值
item12: Copy all parts of an object
复制对象时勿忘其每个部分
item13: Use objects to manage resources
使用对象来管理资源
item14: Think carefully about copying behavior in resource-managing classes
在资源管理类中小心coping 行为
item15: Provide access to raw resources in resource-managing classes
在资源管理类中提供对原始资源的访问
item16: Use the same form in corresponding uses of new and delete
new 和delete时使用相同的形式