Original article:
Online manual
Chapter 1 transition from C to C ++
Clause 1: Try to use const and inline instead of # define
Clause 2: Try to use
Clause 3: Try to use new and delete instead of malloc and free
Clause 4: Try to use C ++-style comments
Chapter 2 Memory Management Clause 5: corresponding new and delete should adopt the same form
Clause 6: Call Delete For pointer members in the destructor
Clause 7: Prepare insufficient memory in advance
Clause 8: When writing operator new and operator Delete, it must follow the general rules.
Clause 9: Avoid hiding the standard form of new
Clause 10: Write operator delete at the same time if operator new is written.
Chapter 3 constructors, destructor and value assignment operators
Clause 11: declare a copy constructor and a value assignment operator for classes requiring dynamic memory allocation
Clause 12: Use initialization whenever possible instead of assigning values in the constructor
Clause 13: the members in the initialization list are listed in the same order as they are declared in the class.
Clause 14: Determine whether the base class has a virtual destructor
Clause 15: Let operator = return * This reference
Clause 16: assign values to all data members in operator =
Clause 17: Check the assignment in operator =
Chapter 4 classes and functions: Design and Declaration
Article 18: strive to make the class Interface complete and minimal
Clause 19: differentiate member functions, non-member functions, and friend Functions
Article 20: avoid data members from the public interface
Clause 21: Use const whenever possible
Clause 22: Try to use "Pass reference" instead of "pass value"
Clause 23: Do not attempt to return a reference when an object must be returned.
Clause 24: exercise caution when selecting between function overload and default parameter values
Clause 25: avoid overloading pointer and number types
Article 26: Beware of potential ambiguity
Article 27: if you do not want to use an implicit function, you must explicitly disable it.
Clause 28: global namespace Division
Chapter 5 categories and functions: implementation
Clause 29: avoid returning internal data handles
Clause 30: avoid such a member function: the returned value is a non-const pointer or reference to the member, but the access level of the member is lower than that of the function.
Clause 31: do not return the reference of a local object or the reference of a pointer initialized with new in the function.
Cla32: delay variable definition as much as possible
Clause 33: wise to use inline
Cla34: Minimize compilation dependencies between files
Chapter 6 inheritance and
Object-oriented Design
Cla35: Make public inheritance reflect the meaning of "yes"
Cla36: differentiate interface inheritance and implement inheritance
Article 37: Do not redefine the inherited non-virtual functions
Clause 38: Do not redefine the inherited default parameter value
Clause 39: Avoid "downgrading" inheritance level
Clause 40: "One" or "achieved"
Cla41: differentiate inheritance from template
Cla42: wise use of private inheritance
Cla43: wise use of multi-Inheritance
Cla44: Say what you want to say; understand what you mean
Chapter 7 Miscellaneous
Clause 45: Find out the functions written and called by C ++ behind the scenes
Cla46
Article 47: Ensure that non-local static objects are initialized before use
Article 48: Focus on compiler warnings
Clause 49: familiar with the standard library
Clause 50: raise awareness of C ++